Commit 73c76703 authored by Edward Lemur's avatar Edward Lemur Committed by LUCI CQ

git-cl: Don't use assertRegexpMatches on tests.

Is not needed, and it's deprecated on Python 3.

Change-Id: I040891ff74708c6606b8c216da3a0bb98d44d977
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2042281
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
Reviewed-by: 's avatarAnthony Polito <apolito@google.com>
parent 6c6827cb
...@@ -2533,8 +2533,12 @@ class TestGitCl(TestCase): ...@@ -2533,8 +2533,12 @@ class TestGitCl(TestCase):
bypass_hooks=True, bypass_hooks=True,
verbose=True, verbose=True,
parallel=False)) parallel=False))
self.assertRegexpMatches(out.getvalue(), 'Issue.*123 has been submitted') self.assertIn(
self.assertRegexpMatches(out.getvalue(), 'Landed as: .*deadbeef') 'Issue chromium-review.googlesource.com/123 has been submitted',
out.getvalue())
self.assertIn(
'Landed as: https://git.googlesource.com/test/+/deadbeef',
out.getvalue())
def _mock_gerrit_changes_for_detail_cache(self): def _mock_gerrit_changes_for_detail_cache(self):
self.mock(git_cl.Changelist, '_GetGerritHost', lambda _: 'host') self.mock(git_cl.Changelist, '_GetGerritHost', lambda _: 'host')
...@@ -2665,12 +2669,12 @@ class TestGitCl(TestCase): ...@@ -2665,12 +2669,12 @@ class TestGitCl(TestCase):
os.path.expanduser('~/.gitcookies')], ), ''), os.path.expanduser('~/.gitcookies')], ), ''),
] ]
self.assertEqual(0, git_cl.main(['creds-check'])) self.assertEqual(0, git_cl.main(['creds-check']))
self.assertRegexpMatches( self.assertTrue(
sys.stdout.getvalue(), sys.stdout.getvalue().startswith(
'^You seem to be using outdated .netrc for git credentials:') 'You seem to be using outdated .netrc for git credentials:'))
self.assertRegexpMatches( self.assertIn(
sys.stdout.getvalue(), '\nConfigured git to use .gitcookies from',
'\nConfigured git to use .gitcookies from') sys.stdout.getvalue())
def test_creds_check_gitcookies_configured_custom_broken(self): def test_creds_check_gitcookies_configured_custom_broken(self):
self._common_creds_check_mocks() self._common_creds_check_mocks()
...@@ -2687,12 +2691,12 @@ class TestGitCl(TestCase): ...@@ -2687,12 +2691,12 @@ class TestGitCl(TestCase):
os.path.expanduser('~/.gitcookies')], ), ''), os.path.expanduser('~/.gitcookies')], ), ''),
] ]
self.assertEqual(0, git_cl.main(['creds-check'])) self.assertEqual(0, git_cl.main(['creds-check']))
self.assertRegexpMatches( self.assertIn(
sys.stdout.getvalue(), 'WARNING: You have configured custom path to .gitcookies: ',
'WARNING: You have configured custom path to .gitcookies: ') sys.stdout.getvalue())
self.assertRegexpMatches( self.assertIn(
sys.stdout.getvalue(), 'However, your configured .gitcookies file is missing.',
'However, your configured .gitcookies file is missing.') sys.stdout.getvalue())
def test_git_cl_comment_add_gerrit(self): def test_git_cl_comment_add_gerrit(self):
self.mock(git_cl.gerrit_util, 'SetReview', self.mock(git_cl.gerrit_util, 'SetReview',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment