diff --git a/pylintrc b/pylintrc index c18424842..e52ac279d 100644 --- a/pylintrc +++ b/pylintrc @@ -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] diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index 00ae0d8c6..b864a8510 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -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: