Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to fix flaky GPG test by stopping gpg-agent
The new GPG tests fail occasionally, for example in https://github.com/mystor/git-revise/pull/99/checks?check_run_id=3785380820 An excerpt from the job log is added below. I'm not sure if problem is the FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra' or the gpg failed to sign commit line; neither should happen. The first sounds like a race between the GPG agent shutdown and the cleanup of the test's temp dir. Try to fix that by stopping the agent before cleanup. Intuitively, this fix makes sense because it's probably not normal to remove $GNUPGHOME while gpg-agent is running. Extract everything that handles our temporary $GNUPGHOME to a fixture, so we can include a cleanup step. This could be tested by repeating this in the CI a number of times but I'm not sure if that's worth it. Unfortunately, the "gpg failed to sign commit" (very last line of the log below) does not tell us which one failed but that probably wouldn't help either. ============================= test session starts ============================== tests/test_gpgsign.py .E ==================================== ERRORS ==================================== ______________________ ERROR at teardown of test_gpgsign _______________________ @pytest.fixture def short_tmpdir(): with tempfile.TemporaryDirectory() as tdir: > yield py.path.local(tdir) tests/conftest.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/tempfile.py:809: in __exit__ self.cleanup() /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/tempfile.py:813: in cleanup _shutil.rmtree(self.name) /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/shutil.py:486: in rmtree _rmtree_safe_fd(fd, path, onerror) /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/shutil.py:444: in _rmtree_safe_fd onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ topfd = 11, path = '/tmp/tmpdqw8v4oq' onerror = <function rmtree.<locals>.onerror at 0x7fe22474da60> def _rmtree_safe_fd(topfd, path, onerror): ... try: > os.unlink(name, dir_fd=topfd) E FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra' /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/shutil.py:442: FileNotFoundError ----------------------------- Captured stdout call ----------------------------- [master (root-commit) 5aa2dc9] commit 1 Author: Bash Author <[email protected]> Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD'] {'check': True} 960d4c0a13a4 commit 1 Updating refs/heads/master (5aa2dc979632e41770014678a2c829369d7eea9a => 960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD'] {'check': True} c67e6e4a4c25 commit 1 Updating refs/heads/master (960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0 => c67e6e4a4c25442f3cdf55d03a57639697420357) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD', '--gpg-sign'] {'check': True} 960d4c0a13a4 commit 1 Updating refs/heads/master (c67e6e4a4c25442f3cdf55d03a57639697420357 => 960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD', '--no-gpg-sign'] {'check': True} c67e6e4a4c25 commit 1 Updating refs/heads/master (960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0 => c67e6e4a4c25442f3cdf55d03a57639697420357) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD', '-S'] {'check': True} 960d4c0a13a4 commit 1 Updating refs/heads/master (c67e6e4a4c25442f3cdf55d03a57639697420357 => 960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD', '--gpg-sign'] {'check': True} subprocess exited with non-zero status: 1 [master 6a92b96] commit 2 Author: Bash Author <[email protected]> [master 07435aa] commit 3 Author: Bash Author <[email protected]> [master 33cebdc] commit 4 Author: Bash Author <[email protected]> Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD~~', '--gpg-sign'] {'check': True} 2b2c0313c39a commit 2 6932b3a0cd34 commit 3 018843b015b2 commit 4 Updating refs/heads/master (33cebdc30539bfeb0fc5e5530d1eee3fda277be1 => 018843b015b2221d9d87e10590dee48d90075f7a) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD~', '--no-gpg-sign'] {'check': True} 8e096b818b34 commit 3 af3a5ac5a196 commit 4 Updating refs/heads/master (018843b015b2221d9d87e10590dee48d90075f7a => af3a5ac5a196d0bef501e14b57fb33e3b683e947) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD~~', '--gpg-sign'] {'check': True} 2b2c0313c39a commit 2 6932b3a0cd34 commit 3 018843b015b2 commit 4 Updating refs/heads/master (af3a5ac5a196d0bef501e14b57fb33e3b683e947 => 018843b015b2221d9d87e10590dee48d90075f7a) ----------------------------- Captured stderr call ----------------------------- gpg: keybox '/tmp/tmpdqw8v4oq/pubring.kbx' created gpg: /tmp/tmpdqw8v4oq/trustdb.gpg: trustdb created gpg: key 1B1CE6765D1A672E marked as ultimately trusted gpg: directory '/tmp/tmpdqw8v4oq/openpgp-revocs.d' created gpg: revocation certificate stored as '/tmp/tmpdqw8v4oq/openpgp-revocs.d/844AB55D2239CF1037507DA71B1CE6765D1A672E.rev' gpg failed to sign commit
- Loading branch information