Skip to content

Isolate test environment #198

Closed
Closed

Description

@nagromc
$ sudo apt install python-tox
$ cd pre-commit-hooks
$ pip install -r requirements-dev.txt
$ make test

gives the following output: https://gist.github.com/nagromc/8d44fa7c3fcddcc0af35fe5d9f789c70#file-make-test-output-txt

After some investigation, I found out my Git configuration was interfering with the tests.

I think the tests should be independent from the environment either by:

  • running env HOME=/tmp make test (to change temporarily the HOME and then ignore my existing Git configuration ~/.gitconfig);
  • or doing a (Python|Docker|Vagrant) trick to isolate the test environment.

Activity

  1. asottile commented on Jun 11, 2017

    @asottile
    Member

    Actually, I think we should just add the other case to this test -- it is a valid way that a user space git could end up in a merge conflict (if you look, we already have two different formats of git conflict output already).

    docker / vagrant would be super overkill for this (and making debugging an absolute nightmare).

  2. asottile commented on Jun 11, 2017

    @asottile
    Member

    What specifically is in your .gitconfig (I'm trying to reproduce this locally so I can improve the testsuite!)

  3. nagromc commented on Jun 12, 2017

    @nagromc
    ContributorAuthor

    Here is my ~/.gitconfig.

  4. asottile commented on Jun 12, 2017

    @asottile
    Member

    fwiw, this is the bit that causes the different behaviour:

    [pull]
        rebase = preserve

    I'll fix up the test suite so it also allows this :)

  5. asottile commented on Jun 12, 2017

    @asottile
    Member

    Actually, hmm this may require more thought since it is no longer a merge conflict but now a rebase conflict. (Fixing the assertion in the testsuite causes the test to fail as it is not detected as a merge conflict)

  6. nagromc commented on Jul 5, 2017

    @nagromc
    ContributorAuthor

    The tests failed as well with git config --global commit.gpgSign true without my USB smartcard inserted.

    pre-commit-hooks v0.9.1

  7. asottile commented on Jul 5, 2017

    @asottile
    Member

    This should fix that: #212

  8. nagromc commented on Jul 5, 2017

    @nagromc
    ContributorAuthor

    Bug fixed in 10 minutes. Wow 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions