mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
git_config: Fixed test.gitconfig getting updated when running tests.
Moved test_GetSyncAnalysisStateData to GitConfigReadWriteTests class. Deleted [repo "syncstate*..] data from tests/fixtures/test.gitconfig. Tested: ./run_tests ... tests/test_git_config.py::GitConfigReadWriteTests::test_GetSyncAnalysisStateData PASSED [ 84%] ... Bug: https://crbug.com/gerrit/15103 Change-Id: I8cb89ce10b025994a045106c9c66dd243ae8ba50 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/319557 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
2ddbf8a8bf
commit
a0f6006ae7
10
tests/fixtures/test.gitconfig
vendored
10
tests/fixtures/test.gitconfig
vendored
@ -11,13 +11,3 @@
|
|||||||
intk = 10k
|
intk = 10k
|
||||||
intm = 10m
|
intm = 10m
|
||||||
intg = 10g
|
intg = 10g
|
||||||
[repo "syncstate.main"]
|
|
||||||
synctime = 2021-09-14T17:23:43.537338Z
|
|
||||||
version = 1
|
|
||||||
[repo "syncstate.sys"]
|
|
||||||
argv = ['/usr/bin/pytest-3']
|
|
||||||
[repo "syncstate.superproject"]
|
|
||||||
test = false
|
|
||||||
[repo "syncstate.options"]
|
|
||||||
verbose = true
|
|
||||||
mpupdate = false
|
|
||||||
|
@ -104,25 +104,6 @@ class GitConfigReadOnlyTests(unittest.TestCase):
|
|||||||
for key, value in TESTS:
|
for key, value in TESTS:
|
||||||
self.assertEqual(value, self.config.GetInt('section.%s' % (key,)))
|
self.assertEqual(value, self.config.GetInt('section.%s' % (key,)))
|
||||||
|
|
||||||
def test_GetSyncAnalysisStateData(self):
|
|
||||||
"""Test config entries with a sync state analysis data."""
|
|
||||||
superproject_logging_data = {}
|
|
||||||
superproject_logging_data['test'] = False
|
|
||||||
options = type('options', (object,), {})()
|
|
||||||
options.verbose = 'true'
|
|
||||||
options.mp_update = 'false'
|
|
||||||
TESTS = (
|
|
||||||
('superproject.test', 'false'),
|
|
||||||
('options.verbose', 'true'),
|
|
||||||
('options.mpupdate', 'false'),
|
|
||||||
('main.version', '1'),
|
|
||||||
)
|
|
||||||
self.config.UpdateSyncAnalysisState(options, superproject_logging_data)
|
|
||||||
sync_data = self.config.GetSyncAnalysisStateData()
|
|
||||||
for key, value in TESTS:
|
|
||||||
self.assertEqual(sync_data[f'{git_config.SYNC_STATE_PREFIX}{key}'], value)
|
|
||||||
self.assertTrue(sync_data[f'{git_config.SYNC_STATE_PREFIX}main.synctime'])
|
|
||||||
|
|
||||||
|
|
||||||
class GitConfigReadWriteTests(unittest.TestCase):
|
class GitConfigReadWriteTests(unittest.TestCase):
|
||||||
"""Read/write tests of the GitConfig class."""
|
"""Read/write tests of the GitConfig class."""
|
||||||
@ -187,6 +168,25 @@ class GitConfigReadWriteTests(unittest.TestCase):
|
|||||||
config = self.get_config()
|
config = self.get_config()
|
||||||
self.assertIsNone(config.GetBoolean('foo.bar'))
|
self.assertIsNone(config.GetBoolean('foo.bar'))
|
||||||
|
|
||||||
|
def test_GetSyncAnalysisStateData(self):
|
||||||
|
"""Test config entries with a sync state analysis data."""
|
||||||
|
superproject_logging_data = {}
|
||||||
|
superproject_logging_data['test'] = False
|
||||||
|
options = type('options', (object,), {})()
|
||||||
|
options.verbose = 'true'
|
||||||
|
options.mp_update = 'false'
|
||||||
|
TESTS = (
|
||||||
|
('superproject.test', 'false'),
|
||||||
|
('options.verbose', 'true'),
|
||||||
|
('options.mpupdate', 'false'),
|
||||||
|
('main.version', '1'),
|
||||||
|
)
|
||||||
|
self.config.UpdateSyncAnalysisState(options, superproject_logging_data)
|
||||||
|
sync_data = self.config.GetSyncAnalysisStateData()
|
||||||
|
for key, value in TESTS:
|
||||||
|
self.assertEqual(sync_data[f'{git_config.SYNC_STATE_PREFIX}{key}'], value)
|
||||||
|
self.assertTrue(sync_data[f'{git_config.SYNC_STATE_PREFIX}main.synctime'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user