Improve tests to support more git versions and different outputs.

Disable warning W0404 in pylint.

BUG=none
TEST=should now work on googlers workstations

Review URL: http://codereview.chromium.org/6456010

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@74242 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
maruel@chromium.org 14 years ago
parent 00e406b55c
commit cdbecc49e9

@ -55,12 +55,13 @@ load-plugins=
# W0141: Used builtin function ''
# W0142: Used * or ** magic
# W0402: Uses of a deprecated module 'string'
# W0404: 41: Reimport 'XX' (imported line NN)
# W0511: TODO
# W0603: Using the global statement
# W0613: Unused argument ''
# W0703: Catch "Exception"
# W6501: Specify string format arguments as logging function parameters
disable=C0103,C0111,C0302,I0011,R0401,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0922,W0122,W0141,W0142,W0402,W0511,W0603,W0613,W0703,W6501
disable=C0103,C0111,C0302,I0011,R0401,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0922,W0122,W0141,W0142,W0402,W0404,W0511,W0603,W0613,W0703,W6501
[REPORTS]

@ -18,6 +18,7 @@ import __builtin__
# Fixes include path.
from super_mox import mox, StdoutCheck, TestCaseUtils, SuperMoxTestBase
import logging
import sys
import gclient_scm
@ -737,12 +738,25 @@ from :3
'069c602044c5388d2d15c3f875b057c852003458')
finally:
rmtree(root_dir)
self.checkstdout(
('\n_____ foo at refs/heads/master\n\n'
'________ running \'git clone -b master --verbose %s %s\' in \'%s\'\n'
'Initialized empty Git repository in %s\n') %
(join(self.root_dir, '.', '.git'), join(root_dir, 'foo'), root_dir,
join(gclient_scm.os.path.realpath(root_dir), 'foo', '.git') + '/'))
msg1 = (
"\n_____ foo at refs/heads/master\n\n"
"________ running 'git clone -b master --verbose %s %s' in '%s'\n"
"Initialized empty Git repository in %s\n") % (
join(self.root_dir, '.', '.git'),
join(root_dir, 'foo'),
root_dir,
join(gclient_scm.os.path.realpath(root_dir), 'foo', '.git') + '/')
msg2 = (
"\n_____ foo at refs/heads/master\n\n"
"________ running 'git clone -b master --verbose %s %s' in '%s'\n"
"Cloning into %s...\ndone.\n") % (
join(self.root_dir, '.', '.git'),
join(root_dir, 'foo'),
root_dir,
join(gclient_scm.os.path.realpath(root_dir), 'foo'))
out = sys.stdout.getvalue()
sys.stdout.close()
self.assertTrue(out in (msg1, msg2), (out, msg1, msg2))
def testUpdateUpdate(self):
if not self.enabled:
@ -769,12 +783,17 @@ from :3
relpath=self.relpath)
file_path = join(self.base_path, 'b')
open(file_path, 'w').writelines('conflict\n')
exception = (
"error: Your local changes to 'b' would be overwritten by merge. "
"Aborting.\n"
"Please, commit your changes or stash them before you can merge.\n")
self.assertRaisesError(exception, scm.update, options, (), [])
self.checkstdout('\n_____ . at refs/heads/master\n')
try:
scm.update(options, (), [])
self.fail()
except gclient_scm.gclient_utils.CheckCallError:
# The exact exception text varies across git versions so it's not worth
# verifying it. It's fine as long as it throws.
pass
# Manually flush stdout since we can't verify it's content accurately across
# git versions.
sys.stdout.getvalue()
sys.stdout.close()
def testUpdateConflict(self):
if not self.enabled:
@ -833,6 +852,11 @@ from :3
if __name__ == '__main__':
if '-v' in sys.argv:
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime).19s %(levelname)s %(filename)s:'
'%(lineno)s %(message)s')
unittest.main()
# vim: ts=2:sw=2:tw=80:et:

Loading…
Cancel
Save