forked from libgit2/pygit2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test utils: implement a repo context manager
The current hierarchy of test cases that create and blow away test repositories in the ``setUp`` and ``tearDown`` methods is inadequate for testing scenarios where multiple repositories must be edited, e.g. testing push. Extract the temporary repository behaviour into a context manager class ``TemporaryRepository`` which can be used via the ``with`` keyword. The context manager's ``__enter__` method returns creates the specified repository in a temporary directory and returns its path. The temporary directory is removed in ``__exit__``. Update the existing test case base classes to use the context manager and invoke ``__enter__`` and ``__exit__`` in the ``setUp`` and ``tearDown`` methods respectively. Finally, make some small tweaks to a handful of tests to get them working under this new system.
- Loading branch information
1 parent
179c7db
commit 74b1628
Showing
3 changed files
with
42 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters