Avoid unsafe assumptions about tempdir content in tests · gitpython-developers/GitPython@ad570de · GitHub
Skip to content

Commit ad570de

Browse files
committed
Avoid unsafe assumptions about tempdir content in tests
test_new_should_raise_on_invalid_repo_location had previously used tempfile.gettempdir() directly to get a path assumed not to be a valid repository, assuming more than necessary about the directory in which temporary files and directories are created. A newly created temporary directory is now used for that check, instead. test_new_should_raise_on_non_existent_path had assumed no repos/foobar existed relative to the current directory. Typically there would be no such directory, but is unnecessary for the test to rely on this. A newly created temporary directory known to be empty is now used in place of the "repos" component, for that test.
1 parent d7bf231 commit ad570de

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/test_repo.py

Lines changed: 6 additions & 2 deletions

0 commit comments

Comments
 (0)