Mercurial > python-hglib
annotate tests/test-config.py @ 128:838c5a91ed44
tests: skip test using assertIn on Python < 2.7
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 31 Jul 2014 15:30:51 -0500 |
parents | e738d6fe5f3f |
children | 9ecb271600fc |
rev | line source |
---|---|
21 | 1 import os, common, hglib |
2 | |
3 class test_config(common.basetest): | |
4 def setUp(self): | |
5 common.basetest.setUp(self) | |
118
e738d6fe5f3f
tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents:
21
diff
changeset
|
6 f = open('.hg/hgrc', 'a') |
e738d6fe5f3f
tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents:
21
diff
changeset
|
7 f.write('[section]\nkey=value\n') |
e738d6fe5f3f
tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents:
21
diff
changeset
|
8 f.close() |
21 | 9 self.client = hglib.open() |
10 | |
11 def test_basic(self): | |
12 config = self.client.config() | |
13 | |
14 self.assertTrue(('section', 'key', 'value') in self.client.config()) | |
15 | |
16 self.assertTrue([('section', 'key', 'value')], | |
17 self.client.config('section')) | |
18 self.assertTrue([('section', 'key', 'value')], | |
19 self.client.config(['section', 'foo'])) | |
20 self.assertRaises(hglib.error.CommandError, | |
21 self.client.config, ['a.b', 'foo']) | |
22 | |
23 def test_show_source(self): | |
24 config = self.client.config(showsource=True) | |
25 | |
26 self.assertTrue((os.path.abspath('.hg/hgrc') + ':2', | |
27 'section', 'key', 'value') in config) |