Bug 2272982 - git-up fails to build with pytest 8: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/ahead-of-upstream/'
Summary: git-up fails to build with pytest 8: FileNotFoundError: [Errno 2] No such fil...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: git-up
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ewoud Kohl van Wijngaarden
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2256331
TreeView+ depends on / blocked
 
Reported: 2024-04-03 14:27 UTC by Tomáš Hrnčiar
Modified: 2024-04-03 14:27 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2024-04-03 14:27:05 UTC
git-up fails to build with pytest 8.


=================================== FAILURES ===================================
____________________________ test_ahead_of_upstream ____________________________

    def test_ahead_of_upstream():
        """ Run 'git up' with result: ahead of upstream """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/ahead-of-upstream/'

PyGitUp/tests/test_ahead_of_upstream.py:38: FileNotFoundError
________________________________ test_detached _________________________________

    def test_detached():
        """ Run 'git up' with detached head """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/detached/'

PyGitUp/tests/test_detached.py:41: FileNotFoundError
________________________________ test_diverged _________________________________

    def test_diverged():
        """ Run 'git up' with result: diverged """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/diverged/'

PyGitUp/tests/test_diverged.py:38: FileNotFoundError
_____________________________ test_fast_forwarded ______________________________

    def test_fast_forwarded():
        """ Run 'git up' with result: fast-forwarding """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/fast-forwarded/'

PyGitUp/tests/test_fast_forwarded.py:32: FileNotFoundError
____________________________ test_faster_forwarded _____________________________

    def test_faster_forwarded():
        """ Run 'git up' with result: (fast) fast-forwarding """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/faster-forwarded/'

PyGitUp/tests/test_faster_fastforwarded.py:34: FileNotFoundError
_______________________________ test_fetch_fail ________________________________

    def test_fetch_fail():
        """ Run 'git up' with a non-existent remote """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/test-fail/'

PyGitUp/tests/test_fetch_fail.py:37: FileNotFoundError
____________________________ test_fetch_interrupted ____________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f6d19267fe0>

    def test_fetch_interrupted(monkeypatch):
        """ Run 'git up' and interrupt on fetch """
    
>       gitup = GitUp(testing=True)

PyGitUp/tests/test_fetch_interrupted.py:7: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <PyGitUp.gitup.GitUp object at 0x7f6d17e220c0>, testing = True
sparse = False

    def __init__(self, testing=False, sparse=False):
        # Sparse init: config only
        if sparse:
            self.git = GitWrapper(None)
    
            # Load configuration
            self.settings = self.default_settings.copy()
            self.load_config()
            return
    
        # Testing: redirect stderr to stdout
        self.testing = testing
        if self.testing:
            self.stderr = sys.stdout  # Quiet testing
        else:  # pragma: no cover
            self.stderr = sys.stderr
    
        self.states = []
        self.should_fetch = True
        self.pushed = False
    
        # Check, if we're in a git repo
        try:
            repo_dir = get_git_dir()
        except (OSError, GitCommandNotFound) as e:
            if isinstance(e, GitCommandNotFound) or e.errno == errno.ENOENT:
                exc = GitError("The git executable could not be found")
                raise exc
            else:
                raise
        else:
            if repo_dir is None:
                exc = GitError("We don't seem to be in a git repository.")
>               raise exc
E               PyGitUp.git_wrapper.GitError: We don't seem to be in a git repository.

PyGitUp/gitup.py:130: GitError
________________________________ test_fetchall _________________________________

    def test_fetchall():
        """ Run 'git up' with fetch.all """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/fetch-all/'

PyGitUp/tests/test_fetchall.py:36: FileNotFoundError
_____________________________ test_not_a_git_repo ______________________________

    def test_not_a_git_repo():
        """ Run 'git up' with git no being in PATH """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/git-not-in-path/'

PyGitUp/tests/test_git_not_in_path.py:20: FileNotFoundError
________________________________ test_issue_55 _________________________________

    def test_issue_55():
        """ Regression test for #55 """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/issue-55/'

PyGitUp/tests/test_issue_55.py:34: FileNotFoundError
_____________________________ test_local_tracking ______________________________

    def test_local_tracking():
        """ Run 'git up' with a local tracking branch """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/local_tracking/'

PyGitUp/tests/test_local_tracking.py:34: FileNotFoundError
________________________________ test_log_hook _________________________________

    def test_log_hook():
        """ Run 'git up' with log-hook"""
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/log-hook/'

PyGitUp/tests/test_log_hook.py:50: FileNotFoundError
_____________________________ test_fast_forwarded ______________________________

    def test_fast_forwarded():
        """ Run 'git up' with multiple remotes """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/multiple-remotes/'

PyGitUp/tests/test_multiple_remotes.py:45: FileNotFoundError
_______________________________ test_no_remotes ________________________________

    def test_no_remotes():
        """ Run 'git up' w/o remotes """
>       os.chdir(master_path)
E       NameError: name 'master_path' is not defined

PyGitUp/tests/test_no_remotes.py:22: NameError
________________________________ test_no_fetch _________________________________

    def test_no_fetch():
        """ Run 'git up' with '--no-fetch' argument """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/no-fetch/'

PyGitUp/tests/test_nofetch.py:48: FileNotFoundError
_____________________________ test_not_a_git_repo ______________________________

    def test_not_a_git_repo():
        """ Run 'git up' being not on a git repo """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/not-on-a-repo/'

PyGitUp/tests/test_not_on_a_git_repo.py:20: FileNotFoundError
_______________________________ test_out_of_tree _______________________________

    def test_out_of_tree():
        """ Run 'git up' with an out-of-tree source """
>       os.chdir(work_tree)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/out-of-tree/work-tree'

PyGitUp/tests/test_out_of_tree.py:50: FileNotFoundError
_____________________________ test_fast_forwarded ______________________________

    def test_fast_forwarded():
        """ Fail correctly when a rebase would overwrite untracked files """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/overwrite_untracked_error/'

PyGitUp/tests/test_overwrite_untracked_error.py:37: FileNotFoundError
________________________________ test_rebasing _________________________________

    def test_rebasing():
        """ Run 'git up' with pushing to origin """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/push/'

PyGitUp/tests/test_push.py:46: FileNotFoundError
____________________________ test_rebase_arguments _____________________________

    def test_rebase_arguments():
        """ Run 'git up' with rebasing.arguments """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/rebase-arguments/'

PyGitUp/tests/test_rebase_arguments.py:52: FileNotFoundError
______________________________ test_rebase_error _______________________________

    def test_rebase_error():
        """ Run 'git up' with a failing rebase """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/rebase_error/'

PyGitUp/tests/test_rebase_error.py:45: FileNotFoundError
________________________________ test_rebasing _________________________________

    def test_rebasing():
        """ Run 'git up' with result: rebasing """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/rebasing/'

PyGitUp/tests/test_rebasing.py:47: FileNotFoundError
__________________________ test_remote_branch_deleted __________________________

    def test_remote_branch_deleted():
        """ Run 'git up' with remotely deleted branch """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/remote-branch-deleted/'

PyGitUp/tests/test_remote_branch_deleted.py:40: FileNotFoundError
___________________________ test_returning_to_branch ___________________________

    def test_returning_to_branch():
        """ Run 'git up': return to branch """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/returning-to-branch/'

PyGitUp/tests/test_returning_to_branch.py:36: FileNotFoundError
______________________________ test_run_in_subdir ______________________________

    def test_run_in_subdir():
        """ Run 'git up' in a subdir of the repo """
        subdir = join(repo_path, 'dir')
>       os.mkdir(subdir)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/run-in-subdir/dir'

PyGitUp/tests/test_run_in_subdir.py:33: FileNotFoundError
____________________________ test_separate_worktree ____________________________

    def test_separate_worktree():
        """ Run 'git up' with separate work tree """
        if Git().version_info[:3] < (2, 5, 1):
            raise SkipTest('Skip this test on Travis CI :(')
    
>       os.chdir(worktree_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/worktree_worktree'

PyGitUp/tests/test_separate_worktree.py:46: FileNotFoundError
_______________________________ test_stash_error _______________________________

    def test_stash_error():
        """ Run 'git up' with an error while stashing """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/stash_error/'

PyGitUp/tests/test_stash_error.py:57: FileNotFoundError
_______________________________ test_submodules ________________________________

    def test_submodules():
        """ Run 'git up' with submodules """
>       repo = Repo(repo_path)

PyGitUp/tests/test_submodules.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Repo' object has no attribute 'git_dir'") raised in repr()] Repo object at 0x7f6d17e854f0>
path = '/tmp/PyGitUp.qd79xfqk/submodule/'
odbt = <class 'git.db.GitCmdObjectDB'>, search_parent_directories = False
expand_vars = True

    def __init__(
        self,
        path: Optional[PathLike] = None,
        odbt: Type[LooseObjectDB] = GitCmdObjectDB,
        search_parent_directories: bool = False,
        expand_vars: bool = True,
    ) -> None:
        """Create a new Repo instance
    
        :param path:
            the path to either the root git directory or the bare git repo::
    
                repo = Repo("/Users/mtrier/Development/git-python")
                repo = Repo("/Users/mtrier/Development/git-python.git")
                repo = Repo("~/Development/git-python.git")
                repo = Repo("$REPOSITORIES/Development/git-python.git")
                repo = Repo("C:\\Users\\mtrier\\Development\\git-python\\.git")
    
            - In *Cygwin*, path may be a `'cygdrive/...'` prefixed path.
            - If it evaluates to false, :envvar:`GIT_DIR` is used, and if this also evals to false,
              the current-directory is used.
        :param odbt:
            Object DataBase type - a type which is constructed by providing
            the directory containing the database objects, i.e. .git/objects. It will
            be used to access all object data
        :param search_parent_directories:
            if True, all parent directories will be searched for a valid repo as well.
    
            Please note that this was the default behaviour in older versions of GitPython,
            which is considered a bug though.
        :raise InvalidGitRepositoryError:
        :raise NoSuchPathError:
        :return: git.Repo"""
    
        epath = path or os.getenv("GIT_DIR")
        if not epath:
            epath = os.getcwd()
        if Git.is_cygwin():
            # Given how the tests are written, this seems more likely to catch
            # Cygwin git used from Windows than Windows git used from Cygwin.
            # Therefore changing to Cygwin-style paths is the relevant operation.
            epath = cygpath(epath)
    
        epath = epath or path or os.getcwd()
        if not isinstance(epath, str):
            epath = str(epath)
        if expand_vars and re.search(self.re_envvars, epath):
            warnings.warn(
                "The use of environment variables in paths is deprecated"
                + "\nfor security reasons and may be removed in the future!!",
                stacklevel=1,
            )
        epath = expand_path(epath, expand_vars)
        if epath is not None:
            if not os.path.exists(epath):
>               raise NoSuchPathError(epath)
E               git.exc.NoSuchPathError: /tmp/PyGitUp.qd79xfqk/submodule

/usr/lib/python3.12/site-packages/git/repo/base.py:215: NoSuchPathError
____________________________ test_submodules_dirty _____________________________

    def test_submodules_dirty():
        """ Run 'git up' with submodules in a dirty repo """
>       repo = Repo(repo_path)

PyGitUp/tests/test_submodules_dirty.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Repo' object has no attribute 'git_dir'") raised in repr()] Repo object at 0x7f6d181241d0>
path = '/tmp/PyGitUp.qd79xfqk/submodule-dirty/'
odbt = <class 'git.db.GitCmdObjectDB'>, search_parent_directories = False
expand_vars = True

    def __init__(
        self,
        path: Optional[PathLike] = None,
        odbt: Type[LooseObjectDB] = GitCmdObjectDB,
        search_parent_directories: bool = False,
        expand_vars: bool = True,
    ) -> None:
        """Create a new Repo instance
    
        :param path:
            the path to either the root git directory or the bare git repo::
    
                repo = Repo("/Users/mtrier/Development/git-python")
                repo = Repo("/Users/mtrier/Development/git-python.git")
                repo = Repo("~/Development/git-python.git")
                repo = Repo("$REPOSITORIES/Development/git-python.git")
                repo = Repo("C:\\Users\\mtrier\\Development\\git-python\\.git")
    
            - In *Cygwin*, path may be a `'cygdrive/...'` prefixed path.
            - If it evaluates to false, :envvar:`GIT_DIR` is used, and if this also evals to false,
              the current-directory is used.
        :param odbt:
            Object DataBase type - a type which is constructed by providing
            the directory containing the database objects, i.e. .git/objects. It will
            be used to access all object data
        :param search_parent_directories:
            if True, all parent directories will be searched for a valid repo as well.
    
            Please note that this was the default behaviour in older versions of GitPython,
            which is considered a bug though.
        :raise InvalidGitRepositoryError:
        :raise NoSuchPathError:
        :return: git.Repo"""
    
        epath = path or os.getenv("GIT_DIR")
        if not epath:
            epath = os.getcwd()
        if Git.is_cygwin():
            # Given how the tests are written, this seems more likely to catch
            # Cygwin git used from Windows than Windows git used from Cygwin.
            # Therefore changing to Cygwin-style paths is the relevant operation.
            epath = cygpath(epath)
    
        epath = epath or path or os.getcwd()
        if not isinstance(epath, str):
            epath = str(epath)
        if expand_vars and re.search(self.re_envvars, epath):
            warnings.warn(
                "The use of environment variables in paths is deprecated"
                + "\nfor security reasons and may be removed in the future!!",
                stacklevel=1,
            )
        epath = expand_path(epath, expand_vars)
        if epath is not None:
            if not os.path.exists(epath):
>               raise NoSuchPathError(epath)
E               git.exc.NoSuchPathError: /tmp/PyGitUp.qd79xfqk/submodule-dirty

/usr/lib/python3.12/site-packages/git/repo/base.py:215: NoSuchPathError
________________________________ test_tracking _________________________________

    def test_tracking():
        """ Run 'git up' with a local tracking branch """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/tracking/'

PyGitUp/tests/test_tracking.py:40: FileNotFoundError
______________________________ test_unstash_error ______________________________

    def test_unstash_error():
        """ Run 'git up' with an unclean unstash """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/unstash_error/'

PyGitUp/tests/test_unstash_error.py:41: FileNotFoundError
_______________________________ test_up_to_date ________________________________

    def test_up_to_date():
        """ Run 'git up' with result: up to date """
>       os.chdir(repo_path)
E       FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PyGitUp.qd79xfqk/up-to-date/'

PyGitUp/tests/test_up_to_date.py:35: FileNotFoundError
=========================== short test summary info ============================
FAILED PyGitUp/tests/test_ahead_of_upstream.py::test_ahead_of_upstream - File...
FAILED PyGitUp/tests/test_detached.py::test_detached - FileNotFoundError: [Er...
FAILED PyGitUp/tests/test_diverged.py::test_diverged - FileNotFoundError: [Er...
FAILED PyGitUp/tests/test_fast_forwarded.py::test_fast_forwarded - FileNotFou...
FAILED PyGitUp/tests/test_faster_fastforwarded.py::test_faster_forwarded - Fi...
FAILED PyGitUp/tests/test_fetch_fail.py::test_fetch_fail - FileNotFoundError:...
FAILED PyGitUp/tests/test_fetch_interrupted.py::test_fetch_interrupted - PyGi...
FAILED PyGitUp/tests/test_fetchall.py::test_fetchall - FileNotFoundError: [Er...
FAILED PyGitUp/tests/test_git_not_in_path.py::test_not_a_git_repo - FileNotFo...
FAILED PyGitUp/tests/test_issue_55.py::test_issue_55 - FileNotFoundError: [Er...
FAILED PyGitUp/tests/test_local_tracking.py::test_local_tracking - FileNotFou...
FAILED PyGitUp/tests/test_log_hook.py::test_log_hook - FileNotFoundError: [Er...
FAILED PyGitUp/tests/test_multiple_remotes.py::test_fast_forwarded - FileNotF...
FAILED PyGitUp/tests/test_no_remotes.py::test_no_remotes - NameError: name 'm...
FAILED PyGitUp/tests/test_nofetch.py::test_no_fetch - FileNotFoundError: [Err...
FAILED PyGitUp/tests/test_not_on_a_git_repo.py::test_not_a_git_repo - FileNot...
FAILED PyGitUp/tests/test_out_of_tree.py::test_out_of_tree - FileNotFoundErro...
FAILED PyGitUp/tests/test_overwrite_untracked_error.py::test_fast_forwarded
FAILED PyGitUp/tests/test_push.py::test_rebasing - FileNotFoundError: [Errno ...
FAILED PyGitUp/tests/test_rebase_arguments.py::test_rebase_arguments - FileNo...
FAILED PyGitUp/tests/test_rebase_error.py::test_rebase_error - FileNotFoundEr...
FAILED PyGitUp/tests/test_rebasing.py::test_rebasing - FileNotFoundError: [Er...
FAILED PyGitUp/tests/test_remote_branch_deleted.py::test_remote_branch_deleted
FAILED PyGitUp/tests/test_returning_to_branch.py::test_returning_to_branch - ...
FAILED PyGitUp/tests/test_run_in_subdir.py::test_run_in_subdir - FileNotFound...
FAILED PyGitUp/tests/test_separate_worktree.py::test_separate_worktree - File...
FAILED PyGitUp/tests/test_stash_error.py::test_stash_error - FileNotFoundErro...
FAILED PyGitUp/tests/test_submodules.py::test_submodules - git.exc.NoSuchPath...
FAILED PyGitUp/tests/test_submodules_dirty.py::test_submodules_dirty - git.ex...
FAILED PyGitUp/tests/test_tracking.py::test_tracking - FileNotFoundError: [Er...
FAILED PyGitUp/tests/test_unstash_error.py::test_unstash_error - FileNotFound...
FAILED PyGitUp/tests/test_up_to_date.py::test_up_to_date - FileNotFoundError:...
=================== 32 failed, 2 passed, 1 skipped in 0.30s ====================


https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07247576-git-up/

For all our attempts to build git-up with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/git-up/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.


Note You need to log in before you can comment on or make changes to this bug.