diff options
| author | Shawn O. Pearce <sop@google.com> | 2009-07-02 16:12:57 -0700 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2009-07-02 16:12:57 -0700 |
| commit | c24c720b6135a8f7975bf9af265124eee2d464cb (patch) | |
| tree | c1460ab9ad60850aed68b25ba6d98a931adc352e /tests | |
| parent | 2d1a3968971366fab7000664959a2d5a39b48996 (diff) | |
| download | git-repo-c24c720b6135a8f7975bf9af265124eee2d464cb.tar.gz | |
Fix error parsing a non-existant configuration filev1.6.8.7
If a file (e.g. ~/.gitconfig) does not exist, we get None
here rather than a string. NoneType lacks rstrip() so we
cannot strip it.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_git_config.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_git_config.py b/tests/test_git_config.py index d67a8bab..5b1770e7 100644 --- a/tests/test_git_config.py +++ b/tests/test_git_config.py | |||
| @@ -39,5 +39,14 @@ class GitConfigUnitTest(unittest.TestCase): | |||
| 39 | val = self.config.GetString('section.nonempty') | 39 | val = self.config.GetString('section.nonempty') |
| 40 | self.assertEqual(val, 'true') | 40 | self.assertEqual(val, 'true') |
| 41 | 41 | ||
| 42 | def test_GetString_from_missing_file(self): | ||
| 43 | """ | ||
| 44 | Test missing config file | ||
| 45 | """ | ||
| 46 | config_fixture = fixture('not.present.gitconfig') | ||
| 47 | config = git_config.GitConfig(config_fixture) | ||
| 48 | val = config.GetString('empty') | ||
| 49 | self.assertEqual(val, None) | ||
| 50 | |||
| 42 | if __name__ == '__main__': | 51 | if __name__ == '__main__': |
| 43 | unittest.main() | 52 | unittest.main() |
