Skip to content

3.1.20: pytest (6.2.4) error #1324

Description

@kloczek

I'm trying to package your module as rpm packag. So I'm using typical in such case build, install and test cycle used on building package from non-root account:

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask for help because few units are failing:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-GitPython-3.1.20-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-GitPython-3.1.20-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --force-sugar
  inifile: /home/tkloczko/rpmbuild/BUILD/GitPython-3.1.20/pyproject.toml
  rootdir: /home/tkloczko/rpmbuild/BUILD/GitPython-3.1.20

Activity

  1. Byron commented on Aug 19, 2021

    @Byron
    Member

    To me it looks like pytest isn't recent enough or it lacks a plugin. Maybe @Yobmod has a better idea about this though.

  2. Yobmod commented on Sep 9, 2021

    @Yobmod
    Contributor

    Hi, sorry for slow reply, I've been away from civilisation.

    You're running the tests directly using pytest?
    You'll either need to install pip install the test-requirements.txt beforehand, or remove any flags from pyproject.toml that don't work without the corresponding plugin being installed. (e.g. The --force-sugar flag (in pyproject.toml) is used by pytest-sugar. )

  3. kloczek commented on Sep 9, 2021

    @kloczek
    Author

    OK I've decided to remove using pytest-sugar as seems like it is only decoration.
    After remove pytest is failing with errors.
    Just in casse I'm using autogenerated from git tah source tar ball.

    Log
    + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-GitPython-3.1.20-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-GitPython-3.1.20-2.fc35.x86_64/usr/lib/python3.8/site-packages
    + /usr/bin/pytest -ra
    =========================================================================== test session starts ============================================================================
    platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
    benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
    Using --randomly-seed=2856828390
    rootdir: /home/tkloczko/rpmbuild/BUILD/GitPython-3.1.20, configfile: pyproject.toml, testpaths: test
    plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, anyio-3.3.0, asyncio-0.15.1, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0, Faker-8.12.1, nose2pytest-1.0.8, pyfakefs-4.5.1, tornado-0.8.1, twisted-1.13.3, aiohttp-0.3.0
    collected 420 items
    
    test/test_docs.py EEEE                                                                                                                                               [  0%]
    test/test_base.py EEEEEE
    
    ================================================================================== ERRORS ==================================================================================
    _______________________________________________________________ ERROR at setup of Tutorials.test_submodules ________________________________________________________________
    
    cls = <class 'test.test_docs.Tutorials'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    _________________________________________________________ ERROR at setup of Tutorials.test_references_and_objects __________________________________________________________
    
    cls = <class 'test.test_docs.Tutorials'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    ____________________________________________________________ ERROR at setup of Tutorials.test_init_repo_object _____________________________________________________________
    
    cls = <class 'test.test_docs.Tutorials'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    ___________________________________________________________ ERROR at setup of Tutorials.test_add_file_and_commit ___________________________________________________________
    
    cls = <class 'test.test_docs.Tutorials'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    _______________________________________________________________ ERROR at setup of TestBase.test_add_unicode ________________________________________________________________
    
    cls = <class 'test.test_base.TestBase'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    ________________________________________________________ ERROR at setup of TestBase.test_with_rw_remote_and_rw_repo ________________________________________________________
    
    cls = <class 'test.test_base.TestBase'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    ____________________________________________________________ ERROR at setup of TestBase.test_object_resolution _____________________________________________________________
    
    cls = <class 'test.test_base.TestBase'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    _______________________________________________________________ ERROR at setup of TestBase.test_base_object ________________________________________________________________
    
    cls = <class 'test.test_base.TestBase'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    _______________________________________________________________ ERROR at setup of TestBase.test_with_rw_repo _______________________________________________________________
    
    cls = <class 'test.test_base.TestBase'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    _________________________________________________________ ERROR at setup of TestBase.test_get_object_type_by_name __________________________________________________________
    
    cls = <class 'test.test_base.TestBase'>
    
        @classmethod
        def setUpClass(cls):
            """
            Dynamically add a read-only repository to our actual type. This way
            each test type has its own repository
            """
            from git import Repo
            gc.collect()
    >       cls.rorepo = Repo(GIT_REPO)
    
    test/lib/helper.py:357:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    git/repo/base.py:225: in __init__
        self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <git.repo.base.Repo ''>
    
        @property
        def common_dir(self) -> PathLike:
            """
            :return: The git dir that holds everything except possibly HEAD,
                FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG, index, and logs/."""
            if self._common_dir:
                return self._common_dir
            elif self.git_dir:
                return self.git_dir
            else:
                # or could return ""
    >           raise InvalidGitRepositoryError()
    E           git.exc.InvalidGitRepositoryError
    
    git/repo/base.py:308: InvalidGitRepositoryError
    
    ---------- coverage: platform linux, python 3.8.12-final-0 -----------
    Name                                Stmts   Miss  Cover
    -------------------------------------------------------
    git/__init__.py                        42      8    81%
    git/cmd.py                            512    314    39%
    git/compat.py                          56     26    54%
    git/config.py                         443    326    26%
    git/db.py                              27     12    56%
    git/diff.py                           267    212    21%
    git/exc.py                             63     34    46%
    git/index/__init__.py                   2      0   100%
    git/index/base.py                     499    418    16%
    git/index/fun.py                      179    149    17%
    git/index/typ.py                       68     20    71%
    git/index/util.py                      50     22    56%
    git/objects/__init__.py                13      0   100%
    git/objects/base.py                    90     47    48%
    git/objects/blob.py                    17      4    76%
    git/objects/commit.py                 270    217    20%
    git/objects/fun.py                    101     84    17%
    git/objects/submodule/__init__.py       0      0   100%
    git/objects/submodule/base.py         581    482    17%
    git/objects/submodule/root.py         137    109    20%
    git/objects/submodule/util.py          51     33    35%
    git/objects/tag.py                     47     33    30%
    git/objects/tree.py                   181    124    31%
    git/objects/util.py                   222    150    32%
    git/refs/__init__.py                    6      0   100%
    git/refs/head.py                       99     69    30%
    git/refs/log.py                       149    100    33%
    git/refs/reference.py                  55     27    51%
    git/refs/remote.py                     32     17    47%
    git/refs/symbolic.py                  328    254    23%
    git/refs/tag.py                        44     24    45%
    git/remote.py                         427    319    25%
    git/repo/__init__.py                    1      0   100%
    git/repo/base.py                      539    355    34%
    git/repo/fun.py                       193    157    19%
    git/types.py                           44     10    77%
    git/util.py                           532    347    35%
    -------------------------------------------------------
    TOTAL                                6367   4503    29%
    
    ========================================================================= short test summary info ==========================================================================
    ERROR test/test_docs.py::Tutorials::test_submodules - git.exc.InvalidGitRepositoryError
    ERROR test/test_docs.py::Tutorials::test_references_and_objects - git.exc.InvalidGitRepositoryError
    ERROR test/test_docs.py::Tutorials::test_init_repo_object - git.exc.InvalidGitRepositoryError
    ERROR test/test_docs.py::Tutorials::test_add_file_and_commit - git.exc.InvalidGitRepositoryError
    ERROR test/test_base.py::TestBase::test_add_unicode - git.exc.InvalidGitRepositoryError
    ERROR test/test_base.py::TestBase::test_with_rw_remote_and_rw_repo - git.exc.InvalidGitRepositoryError
    ERROR test/test_base.py::TestBase::test_object_resolution - git.exc.InvalidGitRepositoryError
    ERROR test/test_base.py::TestBase::test_base_object - git.exc.InvalidGitRepositoryError
    ERROR test/test_base.py::TestBase::test_with_rw_repo - git.exc.InvalidGitRepositoryError
    ERROR test/test_base.py::TestBase::test_get_object_type_by_name - git.exc.InvalidGitRepositoryError
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 10 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ====================================================================== 3 warnings, 10 errors in 2.77s ======================================================================
    pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
  4. Yobmod commented on Sep 9, 2021

    @Yobmod
    Contributor

    These look like the errors I get if git isn't available or is not found.

    Did you follow the README instructions for tests?

    .... needs the git executable to be installed on the system and available in your PATH for most operations. If it is not in your PATH, you can help GitPython find it by setting the GIT_PYTHON_GIT_EXECUTABLE=<path/to/git> environment variable

    Important: Right after cloning this repository, please be sure to have executed the ./init-tests-after-clone.sh script in the repository root. Otherwise you will encounter test failures.

    If you've done those, then i'm stumped.

    I think the error is due to no git_dir being defined. The path given is in helper.py:
    GIT_REPO = os.environ.get("GIT_PYTHON_TEST_GIT_REPO_BASE", ospd(ospd(ospd(__file__))))
    So if this does not return a string-path to a .git (or a dir containing a .git), AND the backup GIT_DIR env variable is not set then all tests fail.

    Do the tests work if you just clone the github repo, run the bash script, and run pytest from the root folder?

  5. kloczek commented on Sep 9, 2021

    @kloczek
    Author

    git binary is avalable in build env.
    OK will try oteher parts of the description.
    Thank you.

  6. Byron commented on Sep 10, 2021

    @Byron
    Member

    Additionally, ./init-tests-after-clone.sh should be executed to get the clone ready for running the tests.

  7. added theissue type on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions