Fixed wrapper related warnings in tests

Multiple "Could not find reference" warnings in test_wrapper.py
and test_git_command.py resolved.

Test: tox
Signed-off-by: Daniel Kutik <daniel.kutik@lavawerk.com>
Change-Id: Ic254c378bbdae6bc3f8f29682ababb37db76adfe
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/353235
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Daniel Kutik 2022-11-28 11:36:01 +01:00
parent e287fa760b
commit 35af2f8daf
2 changed files with 9 additions and 8 deletions

View File

@ -117,7 +117,8 @@ class GitRequireTests(unittest.TestCase):
"""Test the git_require helper.""" """Test the git_require helper."""
def setUp(self): def setUp(self):
ver = wrapper.GitVersion(1, 2, 3, 4) self.wrapper = wrapper.Wrapper()
ver = self.wrapper.GitVersion(1, 2, 3, 4)
mock.patch.object(git_command.git, 'version_tuple', return_value=ver).start() mock.patch.object(git_command.git, 'version_tuple', return_value=ver).start()
def tearDown(self): def tearDown(self):

View File

@ -59,12 +59,12 @@ class RepoWrapperUnitTest(RepoWrapperTestCase):
def test_python_constraints(self): def test_python_constraints(self):
"""The launcher should never require newer than main.py.""" """The launcher should never require newer than main.py."""
self.assertGreaterEqual(main.MIN_PYTHON_VERSION_HARD, self.assertGreaterEqual(main.MIN_PYTHON_VERSION_HARD,
wrapper.MIN_PYTHON_VERSION_HARD) self.wrapper.MIN_PYTHON_VERSION_HARD)
self.assertGreaterEqual(main.MIN_PYTHON_VERSION_SOFT, self.assertGreaterEqual(main.MIN_PYTHON_VERSION_SOFT,
wrapper.MIN_PYTHON_VERSION_SOFT) self.wrapper.MIN_PYTHON_VERSION_SOFT)
# Make sure the versions are themselves in sync. # Make sure the versions are themselves in sync.
self.assertGreaterEqual(wrapper.MIN_PYTHON_VERSION_SOFT, self.assertGreaterEqual(self.wrapper.MIN_PYTHON_VERSION_SOFT,
wrapper.MIN_PYTHON_VERSION_HARD) self.wrapper.MIN_PYTHON_VERSION_HARD)
def test_init_parser(self): def test_init_parser(self):
"""Make sure 'init' GetParser works.""" """Make sure 'init' GetParser works."""
@ -458,7 +458,7 @@ class ResolveRepoRev(GitCheckoutTestCase):
self.assertEqual('refs/heads/stable', rrev) self.assertEqual('refs/heads/stable', rrev)
self.assertEqual(self.REV_LIST[1], lrev) self.assertEqual(self.REV_LIST[1], lrev)
with self.assertRaises(wrapper.CloneFailure): with self.assertRaises(self.wrapper.CloneFailure):
self.wrapper.resolve_repo_rev(self.GIT_DIR, 'refs/heads/unknown') self.wrapper.resolve_repo_rev(self.GIT_DIR, 'refs/heads/unknown')
def test_explicit_tag(self): def test_explicit_tag(self):
@ -467,7 +467,7 @@ class ResolveRepoRev(GitCheckoutTestCase):
self.assertEqual('refs/tags/v1.0', rrev) self.assertEqual('refs/tags/v1.0', rrev)
self.assertEqual(self.REV_LIST[1], lrev) self.assertEqual(self.REV_LIST[1], lrev)
with self.assertRaises(wrapper.CloneFailure): with self.assertRaises(self.wrapper.CloneFailure):
self.wrapper.resolve_repo_rev(self.GIT_DIR, 'refs/tags/unknown') self.wrapper.resolve_repo_rev(self.GIT_DIR, 'refs/tags/unknown')
def test_branch_name(self): def test_branch_name(self):
@ -502,7 +502,7 @@ class ResolveRepoRev(GitCheckoutTestCase):
def test_unknown(self): def test_unknown(self):
"""Check unknown ref/commit argument.""" """Check unknown ref/commit argument."""
with self.assertRaises(wrapper.CloneFailure): with self.assertRaises(self.wrapper.CloneFailure):
self.wrapper.resolve_repo_rev(self.GIT_DIR, 'boooooooya') self.wrapper.resolve_repo_rev(self.GIT_DIR, 'boooooooya')