diff options
Diffstat (limited to 'tests/test_git_config.py')
| -rw-r--r-- | tests/test_git_config.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_git_config.py b/tests/test_git_config.py index a4fad9ef..0df38430 100644 --- a/tests/test_git_config.py +++ b/tests/test_git_config.py | |||
| @@ -19,6 +19,7 @@ import tempfile | |||
| 19 | import unittest | 19 | import unittest |
| 20 | 20 | ||
| 21 | import git_config | 21 | import git_config |
| 22 | import repo_trace | ||
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | def fixture(*paths): | 25 | def fixture(*paths): |
| @@ -33,9 +34,16 @@ class GitConfigReadOnlyTests(unittest.TestCase): | |||
| 33 | def setUp(self): | 34 | def setUp(self): |
| 34 | """Create a GitConfig object using the test.gitconfig fixture. | 35 | """Create a GitConfig object using the test.gitconfig fixture. |
| 35 | """ | 36 | """ |
| 37 | |||
| 38 | self.tempdirobj = tempfile.TemporaryDirectory(prefix='repo_tests') | ||
| 39 | repo_trace._TRACE_FILE = os.path.join(self.tempdirobj.name, 'TRACE_FILE_from_test') | ||
| 40 | |||
| 36 | config_fixture = fixture('test.gitconfig') | 41 | config_fixture = fixture('test.gitconfig') |
| 37 | self.config = git_config.GitConfig(config_fixture) | 42 | self.config = git_config.GitConfig(config_fixture) |
| 38 | 43 | ||
| 44 | def tearDown(self): | ||
| 45 | self.tempdirobj.cleanup() | ||
| 46 | |||
| 39 | def test_GetString_with_empty_config_values(self): | 47 | def test_GetString_with_empty_config_values(self): |
| 40 | """ | 48 | """ |
| 41 | Test config entries with no value. | 49 | Test config entries with no value. |
| @@ -109,9 +117,15 @@ class GitConfigReadWriteTests(unittest.TestCase): | |||
| 109 | """Read/write tests of the GitConfig class.""" | 117 | """Read/write tests of the GitConfig class.""" |
| 110 | 118 | ||
| 111 | def setUp(self): | 119 | def setUp(self): |
| 120 | self.tempdirobj = tempfile.TemporaryDirectory(prefix='repo_tests') | ||
| 121 | repo_trace._TRACE_FILE = os.path.join(self.tempdirobj.name, 'TRACE_FILE_from_test') | ||
| 122 | |||
| 112 | self.tmpfile = tempfile.NamedTemporaryFile() | 123 | self.tmpfile = tempfile.NamedTemporaryFile() |
| 113 | self.config = self.get_config() | 124 | self.config = self.get_config() |
| 114 | 125 | ||
| 126 | def tearDown(self): | ||
| 127 | self.tempdirobj.cleanup() | ||
| 128 | |||
| 115 | def get_config(self): | 129 | def get_config(self): |
| 116 | """Get a new GitConfig instance.""" | 130 | """Get a new GitConfig instance.""" |
| 117 | return git_config.GitConfig(self.tmpfile.name) | 131 | return git_config.GitConfig(self.tmpfile.name) |
