We used the tests to check whether the right exception was returned but
python 3.8 breaks this again:
File "/var/scratch/src/git-buildpackage/git-buildpackage/tests/doctests/test_GitVfs.py", line 56, in test_read
Failed example:
gf = vfs.open('doesnotexist') # doctest:+ELLIPSIS
Expected:
Traceback (most recent call last):
...
OSError: can't get HEAD:doesnotexist: fatal: Path 'doesnotexist' does not exist in 'HEAD'
Got:
Traceback (most recent call last):
File "/var/scratch/src/git-buildpackage/git-buildpackage/gbp/git/vfs.py", line 74, in open
return GitVfs._File(self._repo.show(
File "/var/scratch/src/git-buildpackage/git-buildpackage/gbp/git/repository.py", line 1645, in show
raise GitRepositoryError("can't get %s: %s" % (id, stderr.decode().rstrip()))
gbp.git.repository.GitRepositoryError: can't get HEAD:doesnotexist: fatal: path 'doesnotexist' does not exist in 'HEAD'
<BLANKLINE>
During handling of the above exception, another exception occurred:
<BLANKLINE>
Traceback (most recent call last):
File "/usr/lib/python3.8/doctest.py", line 1329, in __run
exec(compile(example.source, filename, "single",
File "<doctest test_read[12]>", line 1, in <module>
gf = vfs.open('doesnotexist') # doctest:+ELLIPSIS
File "/var/scratch/src/git-buildpackage/git-buildpackage/gbp/git/vfs.py", line 78, in open
raise OSError(e)
OSError: can't get HEAD:doesnotexist: fatal: path 'doesnotexist' does not exist in 'HEAD'
Doctest were a nice feature but keeping up with the subtle breackage is
too cumbersome.
>>> gf.close()
>>> gbp.git.vfs.GitVfs(repo, 'HEAD').open('foo.txt').read() == content.decode()
True
- >>> gf = vfs.open('doesnotexist')
+ >>> gf = vfs.open('doesnotexist') # doctest:+IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
OSError: can't get HEAD:doesnotexist: fatal: Path 'doesnotexist' does not exist in 'HEAD'
>>> gf.close()
>>> gbp.git.vfs.GitVfs(repo, 'HEAD').open('foo.txt', 'rb').read() == content
True
- >>> gf = vfs.open('doesnotexist')
+ >>> gf = vfs.open('doesnotexist') # doctest:+IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
OSError: can't get HEAD:doesnotexist: fatal: Path 'doesnotexist' does not exist in 'HEAD'
>>> repo = gbp.deb.git.DebianGitRepository(dirs['repo'])
>>> _gbp_log_err_bak = gbp.log.err
>>> gbp.log.err = lambda x: None
- >>> repo.pristine_tar.checkout('upstream', '1.1', 'gzip', '..')
+ >>> repo.pristine_tar.checkout('upstream', '1.1', 'gzip', '..') # doctest:+IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
gbp.command_wrappers.CommandExecFailed: Pristine-tar couldn't checkout "upstream_1.1.orig.tar.gz": fatal: Path 'upstream_1.1.orig.tar.gz.delta' does not exist in 'refs/heads/pristine-tar'