<86>Dec 11 06:52:55 userdel[79837]: delete user 'rooter' <86>Dec 11 06:52:55 userdel[79837]: removed group 'rooter' owned by 'rooter' <86>Dec 11 06:52:55 userdel[79837]: removed shadow group 'rooter' owned by 'rooter' <86>Dec 11 06:52:55 groupadd[79908]: group added to /etc/group: name=rooter, GID=540 <86>Dec 11 06:52:55 groupadd[79908]: group added to /etc/gshadow: name=rooter <86>Dec 11 06:52:55 groupadd[79908]: new group: name=rooter, GID=540 <86>Dec 11 06:52:55 useradd[79922]: new user: name=rooter, UID=540, GID=540, home=/root, shell=/bin/bash <86>Dec 11 06:52:55 userdel[80092]: delete user 'builder' <86>Dec 11 06:52:55 groupadd[80514]: group added to /etc/group: name=builder, GID=541 <86>Dec 11 06:52:55 groupadd[80514]: group added to /etc/gshadow: name=builder <86>Dec 11 06:52:55 groupadd[80514]: new group: name=builder, GID=541 <86>Dec 11 06:52:55 useradd[80725]: new user: name=builder, UID=541, GID=541, home=/usr/src, shell=/bin/bash <13>Dec 11 06:52:59 rpmi: libgdbm-1.8.3-alt10 1454943334 installed <13>Dec 11 06:52:59 rpmi: libexpat-2.2.4-alt1 1503305345 installed <13>Dec 11 06:52:59 rpmi: libtasn1-4.13-alt2 1521133850 installed <13>Dec 11 06:52:59 rpmi: libp11-kit-0.23.9-alt5 1525798298 installed <13>Dec 11 06:52:59 rpmi: rpm-macros-alternatives-0.4.5-alt1.1 1404382149 installed <13>Dec 11 06:52:59 rpmi: alternatives-0.4.5-alt1.1 1404382149 installed <13>Dec 11 06:52:59 rpmi: ca-certificates-2018.11.12-alt1 sisyphus.216395.300 1542114035 installed <13>Dec 11 06:52:59 rpmi: ca-trust-0.1.1-alt2 1515595785 installed <13>Dec 11 06:52:59 rpmi: p11-kit-trust-0.23.9-alt5 1525798298 installed <13>Dec 11 06:52:59 rpmi: libcrypto1.1-1.1.0j-alt1 sisyphus.216647.100 1542743878 installed <13>Dec 11 06:52:59 rpmi: libssl1.1-1.1.0j-alt1 sisyphus.216647.100 1542743878 installed <13>Dec 11 06:52:59 rpmi: rpm-build-python3-0.1.13.1-alt2 1535450458 installed <13>Dec 11 06:52:59 rpmi: tests-for-installed-python3-pkgs-0.1.13.1-alt2 1535450458 installed <13>Dec 11 06:52:59 rpmi: python3-3.6.5-alt1.1 1535734576 installed <13>Dec 11 06:53:00 rpmi: python3-base-3.6.5-alt1.1 1535734576 installed <13>Dec 11 06:53:00 rpmi: libpython3-3.6.5-alt1.1 1535734576 installed <13>Dec 11 06:53:05 rpmi: python3-module-pkg_resources-1:40.5.0-alt1 sisyphus.216029.100 1541106477 installed <13>Dec 11 06:53:05 rpmi: libverto-0.3.0-alt1_5 1525957714 installed <13>Dec 11 06:53:05 rpmi: libtinfo-devel-6.1.20180407-alt2 sisyphus.215627.200 1540831974 installed <13>Dec 11 06:53:06 rpmi: libncurses-devel-6.1.20180407-alt2 sisyphus.215627.200 1540831974 installed <13>Dec 11 06:53:06 rpmi: python3-dev-3.6.5-alt1.1 1535734576 installed <13>Dec 11 06:53:06 rpmi: libkeyutils-1.6-alt2 sisyphus.217337.100 1544003161 installed <86>Dec 11 06:53:06 groupadd[113279]: group added to /etc/group: name=_keytab, GID=499 <86>Dec 11 06:53:06 groupadd[113279]: group added to /etc/gshadow: name=_keytab <86>Dec 11 06:53:06 groupadd[113279]: new group: name=_keytab, GID=499 <13>Dec 11 06:53:06 rpmi: libkrb5-1.16.2-alt2 sisyphus.216877.200 1543483297 installed <13>Dec 11 06:53:06 rpmi: libtirpc-1.0.3-alt1 1532008017 installed <13>Dec 11 06:53:06 rpmi: libnsl2-1.1.0-alt1_1 1511548749 installed <13>Dec 11 06:53:06 rpmi: python-modules-encodings-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-modules-compiler-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-modules-email-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-modules-unittest-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-modules-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-modules-nis-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-modules-ctypes-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-modules-multiprocessing-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-modules-logging-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python-tools-2to3-2.7.15-alt1 sisyphus.217364.100 1544022423 installed <13>Dec 11 06:53:06 rpmi: python3-module-setuptools-1:40.5.0-alt1 sisyphus.216029.100 1541106477 installed <13>Dec 11 06:53:06 rpmi: python3-module-distutils-extra-2.39-alt1 1490683876 installed Building target platforms: i586 Building for target i586 Wrote: /usr/src/in/nosrpm/python3-module-mocker-1.1.1-alt1.bzr20130910.1.2.nosrc.rpm Installing python3-module-mocker-1.1.1-alt1.bzr20130910.1.2.src.rpm Building target platforms: i586 Building for target i586 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.61561 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf python3-module-mocker-1.1.1 + echo 'Source #0 (python3-module-mocker-1.1.1.tar):' Source #0 (python3-module-mocker-1.1.1.tar): + /bin/tar -xf /usr/src/RPM/SOURCES/python3-module-mocker-1.1.1.tar + cd python3-module-mocker-1.1.1 + /bin/chmod -c -Rf u+rwX,go-w . + find -type f -name '*.py' -exec 2to3 -w -n '{}' + RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored ./test.py --- ./test.py (original) +++ ./test.py (refactored) @@ -30,8 +30,8 @@ class TestCase(unittest.TestCase): """Python 2.3 lacked a couple of useful aliases.""" - assertTrue = unittest.TestCase.failUnless - assertFalse = unittest.TestCase.failIf + assertTrue = unittest.TestCase.assertTrue + assertFalse = unittest.TestCase.assertFalse class CleanMocker(MockerBase): @@ -115,7 +115,7 @@ obj.x self.mocker.result(42) self.mocker.replay() - self.assertEquals(obj.x, 42) + self.assertEqual(obj.x, 42) def test_throw(self): obj = self.mocker.mock() @@ -149,8 +149,8 @@ obj.x(24) self.mocker.call(func) self.mocker.replay() - self.assertEquals(obj.x(24), 42) - self.assertEquals(calls, [24]) + self.assertEqual(obj.x(24), 42) + self.assertEqual(calls, [24]) def test_call_result(self): calls = [] @@ -162,8 +162,8 @@ self.mocker.call(func) self.mocker.result(42) self.mocker.replay() - self.assertEquals(obj.x(24), 42) - self.assertEquals(calls, [24]) + self.assertEqual(obj.x(24), 42) + self.assertEqual(calls, [24]) def test_call_with_object(self): class C(object): @@ -182,8 +182,8 @@ self.mocker.replay() obj = C() - self.assertEquals(obj.method(1, 2, c=3), 4) # Mocked. - self.assertEquals(calls, [(obj, 1, 2), {"c": 3}]) + self.assertEqual(obj.method(1, 2, c=3), 4) # Mocked. + self.assertEqual(calls, [(obj, 1, 2), {"c": 3}]) def test_generate(self): obj = self.mocker.mock() @@ -192,8 +192,8 @@ self.mocker.replay() result = obj.x(24) def g(): yield None - self.assertEquals(type(result), type(g())) - self.assertEquals(list(result), [1, 2, 3]) + self.assertEqual(type(result), type(g())) + self.assertEqual(list(result), [1, 2, 3]) def test_proxy(self): class C(object): @@ -207,12 +207,12 @@ self.mocker.replay() - self.assertEquals(obj.multiply(2, 3), 6) # Mocked. + self.assertEqual(obj.multiply(2, 3), 6) # Mocked. self.assertRaises(AttributeError, obj.multiply) # Passed through. - self.assertEquals(obj.sum(2, 3), 5) # Passed through. - self.assertEquals(obj.sum(0, 0), 1) # Mocked. - self.assertEquals(obj.sum(0, 0), 0) # Passed through explicitly. + self.assertEqual(obj.sum(2, 3), 5) # Passed through. + self.assertEqual(obj.sum(0, 0), 1) # Mocked. + self.assertEqual(obj.sum(0, 0), 0) # Passed through explicitly. self.assertRaises(AssertionError, obj.sum, 0, 0) # Seen twice. def test_replace_install_and_restore(self): @@ -231,8 +231,8 @@ expect(path.join(ARGS)).call(lambda *args: "-".join(args)) expect(path.join("e", ARGS)).passthrough() self.mocker.replay() - self.assertEquals(os.path.join("a", "b", "c"), "a-b-c") - self.assertNotEquals(os.path.join("e", "f", "g"), "e-f-g") + self.assertEqual(os.path.join("a", "b", "c"), "a-b-c") + self.assertNotEqual(os.path.join("e", "f", "g"), "e-f-g") def test_replace_os_path_isfile(self): path = self.mocker.replace("os.path") @@ -247,8 +247,8 @@ empty = self.mocker.replace("Queue.Queue.empty") expect(empty()).result(False) self.mocker.replay() - from Queue import Queue - self.assertEquals(Queue().empty(), False) + from queue import Queue + self.assertEqual(Queue().empty(), False) def test_patch_with_spec(self): class C(object): @@ -279,7 +279,7 @@ iter(mock) self.mocker.result(iter([1, 2, 3])) self.mocker.replay() - self.assertEquals(list(mock), [1, 2, 3]) + self.assertEqual(list(mock), [1, 2, 3]) self.mocker.verify() def test_replace_builtin_function(self): @@ -292,7 +292,7 @@ mock() self.mocker.result(42) self.mocker.replay() - self.assertEquals(mock(), 42) + self.assertEqual(mock(), 42) class ExpectTest(TestCase): @@ -304,20 +304,20 @@ obj = self.mocker.mock() expect(obj.attr).result(123) self.mocker.replay() - self.assertEquals(obj.attr, 123) + self.assertEqual(obj.attr, 123) def test_chaining(self): obj = self.mocker.mock() expect(obj.attr).result(123).result(42) self.mocker.replay() - self.assertEquals(obj.attr, 42) + self.assertEqual(obj.attr, 42) def test_explicit_expect_instance(self): obj = self.mocker.mock() myexpect = Expect(self.mocker) myexpect(iter(obj)).generate([1, 2, 3]).count(1, 2) self.mocker.replay() - self.assertEquals(list(obj), [1, 2, 3]) + self.assertEqual(list(obj), [1, 2, 3]) class MockerTestCaseTest(TestCase): @@ -331,7 +331,7 @@ self.test.run() def test_has_mocker(self): - self.assertEquals(type(self.test.mocker), Mocker) + self.assertEqual(type(self.test.mocker), Mocker) def test_has_expect(self): self.assertTrue(issubclass(self.test.expect, expect)) @@ -347,18 +347,18 @@ pass test_method.foo = "bar" test = MyTest("test_method") - self.assertEquals(getattr(test.test_method, "im_class", None), MyTest) - self.assertEquals(getattr(test.test_method, "foo", None), "bar") + self.assertEqual(getattr(test.test_method, "im_class", None), MyTest) + self.assertEqual(getattr(test.test_method, "foo", None), "bar") def test_constructor_is_the_same(self): - self.assertEquals(inspect.getargspec(TestCase.__init__), + self.assertEqual(inspect.getargspec(TestCase.__init__), inspect.getargspec(MockerTestCase.__init__)) def test_docstring_is_the_same(self): class MyTest(MockerTestCase): def test_method(self): """Hello there!""" - self.assertEquals(MyTest("test_method").test_method.__doc__, + self.assertEqual(MyTest("test_method").test_method.__doc__, "Hello there!") def test_short_description_is_the_same(self): @@ -369,7 +369,7 @@ def test_method(self): """Hello there!""" - self.assertEquals(MyTest("test_method").shortDescription(), + self.assertEqual(MyTest("test_method").shortDescription(), StandardTest("test_method").shortDescription()) def test_missing_method_raises_the_same_error(self): @@ -378,7 +378,7 @@ try: MyTest("unexistent_method").run() - except Exception, e: + except Exception as e: expected_error = e class MyTest(MockerTestCase): @@ -386,9 +386,9 @@ try: MyTest("unexistent_method").run() - except Exception, e: - self.assertEquals(str(e), str(expected_error)) - self.assertEquals(type(e), type(expected_error)) + except Exception as e: + self.assertEqual(str(e), str(expected_error)) + self.assertEqual(type(e), type(expected_error)) def test_raises_runtime_error_if_not_in_replay_mode_with_events(self): class MyTest(MockerTestCase): @@ -429,7 +429,7 @@ result = unittest.TestResult() MyTest("test_method").run(result) - self.assertEquals(calls, ["verify", "restore"]) + self.assertEqual(calls, ["verify", "restore"]) self.assertTrue(result.wasSuccessful()) del calls[:] @@ -437,9 +437,9 @@ result = unittest.TestResult() MyTest("test_method_raising").run(result) - self.assertEquals(calls, ["restore"]) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 1) + self.assertEqual(calls, ["restore"]) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 1) self.assertTrue("BOOM!" in result.failures[0][1]) del calls[:] @@ -450,7 +450,7 @@ test.run(result) test.run(result) - self.assertEquals(calls, ["verify", "restore", "verify", "restore"]) + self.assertEqual(calls, ["verify", "restore", "verify", "restore"]) self.assertTrue(result.wasSuccessful()) def test_expectation_failure_acts_appropriately(self): @@ -463,8 +463,8 @@ result = unittest.TestResult() MyTest("test_method").run(result) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 1) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 1) self.assertTrue("mock.x" in result.failures[0][1]) def test_add_cleanup(self): @@ -481,7 +481,7 @@ MyTest("test_method").run() - self.assertEquals(stash, [[], (1, 2), (3, 4)]) + self.assertEqual(stash, [[], (1, 2), (3, 4)]) def test_cleanup_wrapper_in__call__for_2_3(self): version_info = sys.version_info @@ -496,7 +496,7 @@ def test_method(self): pass MyTest("test_method")() - self.assertEquals(stash, [True]) + self.assertEqual(stash, [True]) finally: unittest.TestCase.__call__ = __call__ sys.version_info = version_info @@ -516,7 +516,7 @@ MyTest("test_method")() # Python 2.4+ handles cleanup in run(), registered inside # MockerTestCase.__init__, so this should *not* work. - self.assertEquals(stash, []) + self.assertEqual(stash, []) finally: unittest.TestCase.__call__ = __call__ sys.version_info = version_info @@ -548,26 +548,26 @@ test = MyTest("test_method") deferred = test.test_method() - self.assertEquals(deferred, deferreds[-1]) - self.assertEquals(calls, []) - self.assertEquals(len(callbacks), 1) - self.assertEquals(callbacks[-1]("foo"), "foo") - self.assertEquals(calls, ["verify"]) + self.assertEqual(deferred, deferreds[-1]) + self.assertEqual(calls, []) + self.assertEqual(len(callbacks), 1) + self.assertEqual(callbacks[-1]("foo"), "foo") + self.assertEqual(calls, ["verify"]) def test_fail_unless_is_raises_on_mismatch(self): try: self.test.failUnlessIs([], []) - except AssertionError, e: - self.assertEquals(str(e), "[] is not []") + except AssertionError as e: + self.assertEqual(str(e), "[] is not []") else: self.fail("AssertionError not raised") def test_fail_unless_is_uses_msg(self): try: self.test.failUnlessIs([], [], "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -582,8 +582,8 @@ obj = [] try: self.test.failIfIs(obj, obj) - except AssertionError, e: - self.assertEquals(str(e), "[] is []") + except AssertionError as e: + self.assertEqual(str(e), "[] is []") else: self.fail("AssertionError not raised") @@ -591,8 +591,8 @@ obj = [] try: self.test.failIfIs(obj, obj, "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -605,16 +605,16 @@ def test_fail_unless_in_raises_on_mismatch(self): try: self.test.failUnlessIn(1, []) - except AssertionError, e: - self.assertEquals(str(e), "1 not in []") + except AssertionError as e: + self.assertEqual(str(e), "1 not in []") else: self.fail("AssertionError not raised") def test_fail_unless_in_uses_msg(self): try: self.test.failUnlessIn(1, [], "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -627,16 +627,16 @@ def test_fail_if_in_raises_on_mismatch(self): try: self.test.failIfIn(1, [1]) - except AssertionError, e: - self.assertEquals(str(e), "1 in [1]") + except AssertionError as e: + self.assertEqual(str(e), "1 in [1]") else: self.fail("AssertionError not raised") def test_fail_if_in_uses_msg(self): try: self.test.failIfIn(1, [1], "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -649,16 +649,16 @@ def test_fail_unless_starts_with_raises_on_mismatch(self): try: self.test.failUnlessStartsWith("abc", "def") - except AssertionError, e: - self.assertEquals(str(e), "'abc' doesn't start with 'def'") + except AssertionError as e: + self.assertEqual(str(e), "'abc' doesn't start with 'def'") else: self.fail("AssertionError not raised") def test_fail_unless_starts_with_uses_msg(self): try: self.test.failUnlessStartsWith("abc", "def", "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -676,16 +676,16 @@ def test_fail_if_starts_with_raises_on_mismatch(self): try: self.test.failIfStartsWith("abcdef", "abc") - except AssertionError, e: - self.assertEquals(str(e), "'abcdef' starts with 'abc'") + except AssertionError as e: + self.assertEqual(str(e), "'abcdef' starts with 'abc'") else: self.fail("AssertionError not raised") def test_fail_if_starts_with_uses_msg(self): try: self.test.failIfStartsWith("abcdef", "abc", "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -703,16 +703,16 @@ def test_fail_unless_ends_with_raises_on_mismatch(self): try: self.test.failUnlessEndsWith("abc", "def") - except AssertionError, e: - self.assertEquals(str(e), "'abc' doesn't end with 'def'") + except AssertionError as e: + self.assertEqual(str(e), "'abc' doesn't end with 'def'") else: self.fail("AssertionError not raised") def test_fail_unless_ends_with_uses_msg(self): try: self.test.failUnlessEndsWith("abc", "def", "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -730,16 +730,16 @@ def test_fail_if_ends_with_raises_on_mismatch(self): try: self.test.failIfEndsWith("abcdef", "def") - except AssertionError, e: - self.assertEquals(str(e), "'abcdef' ends with 'def'") + except AssertionError as e: + self.assertEqual(str(e), "'abcdef' ends with 'def'") else: self.fail("AssertionError not raised") def test_fail_if_ends_with_uses_msg(self): try: self.test.failIfEndsWith("abcdef", "def", "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -757,16 +757,16 @@ def test_fail_unless_approximates_raises_on_mismatch(self): try: self.test.failUnlessApproximates(1, 2, 0.999) - except AssertionError, e: - self.assertEquals(str(e), "abs(1 - 2) > 0.999") + except AssertionError as e: + self.assertEqual(str(e), "abs(1 - 2) > 0.999") else: self.fail("AssertionError not raised") def test_fail_unless_approximates_uses_msg(self): try: self.test.failUnlessApproximates(1, 2, 0.999, "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -779,16 +779,16 @@ def test_fail_if_approximates_raises_on_mismatch(self): try: self.test.failIfApproximates(1, 2, 1) - except AssertionError, e: - self.assertEquals(str(e), "abs(1 - 2) <= 1") + except AssertionError as e: + self.assertEqual(str(e), "abs(1 - 2) <= 1") else: self.fail("AssertionError not raised") def test_fail_if_approximates_uses_msg(self): try: self.test.failIfApproximates(1, 2, 1, "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -805,8 +805,8 @@ def method(self, b): pass try: self.test.failUnlessMethodsMatch(Fake, Real) - except AssertionError, e: - self.assertEquals(str(e), "Fake.method(self, a) != " + except AssertionError as e: + self.assertEqual(str(e), "Fake.method(self, a) != " "Real.method(self, b)") else: self.fail("AssertionError not raised") @@ -818,8 +818,8 @@ pass try: self.test.failUnlessMethodsMatch(Fake, Real) - except AssertionError, e: - self.assertEquals(str(e), "Fake.method(self, a) not present " + except AssertionError as e: + self.assertEqual(str(e), "Fake.method(self, a) not present " "in Real") else: self.fail("AssertionError not raised") @@ -830,7 +830,7 @@ pass try: self.test.failUnlessMethodsMatch(Fake, Real) - except AssertionError, e: + except AssertionError as e: self.fail("AssertionError shouldn't be raised") def test_fail_unless_methods_match_raises_on_different_priv_method(self): @@ -840,8 +840,8 @@ def _method(self, b): pass try: self.test.failUnlessMethodsMatch(Fake, Real) - except AssertionError, e: - self.assertEquals(str(e), "Fake._method(self, a) != " + except AssertionError as e: + self.assertEqual(str(e), "Fake._method(self, a) != " "Real._method(self, b)") else: self.fail("AssertionError not raised") @@ -862,16 +862,16 @@ pass def f(*args): raise MyException(*args) - error = self.test.failUnlessRaises(MyException, f, 1, "foo") - self.assertEquals(error.args, (1, "foo")) + error = self.test.assertRaises(MyException, f, 1, "foo") + self.assertEqual(error.args, (1, "foo")) def test_fail_unless_raises_error(self): def f(*args): return args try: - self.test.failUnlessRaises(ValueError, f, 1, "foo") - except AssertionError, e: - self.assertEquals( + self.test.assertRaises(ValueError, f, 1, "foo") + except AssertionError as e: + self.assertEqual( str(e), "ValueError not raised ((1, 'foo') returned)") else: @@ -885,7 +885,7 @@ def f(*args): raise MyException2(*args) try: - self.test.failUnlessRaises(MyException1, f, 1, "foo") + self.test.assertRaises(MyException1, f, 1, "foo") except MyException2: pass else: @@ -894,21 +894,21 @@ def test_fail_unless_raises_context_succeeds(self): class MyException(Exception): pass - with_manager = self.test.failUnlessRaises(MyException) + with_manager = self.test.assertRaises(MyException) cm = with_manager.__enter__() - self.assertEquals(with_manager.__exit__(MyException, + self.assertEqual(with_manager.__exit__(MyException, MyException(1, "foo"), None), True) - self.assertEquals(cm.exception.args, (1, "foo")) + self.assertEqual(cm.exception.args, (1, "foo")) def test_fail_unless_raises_context_error(self): - with_manager = self.test.failUnlessRaises(ValueError) + with_manager = self.test.assertRaises(ValueError) cm = with_manager.__enter__() try: with_manager.__exit__(None, None, None) - except AssertionError, e: - self.assertEquals(str(e), "ValueError not raised") - self.assertEquals(cm.exception, None) + except AssertionError as e: + self.assertEqual(str(e), "ValueError not raised") + self.assertEqual(cm.exception, None) else: self.fail("AssertionError not raised") @@ -917,9 +917,9 @@ pass class MyException2(Exception): pass - with_manager = self.test.failUnlessRaises(MyException1) + with_manager = self.test.assertRaises(MyException1) cm = with_manager.__enter__() - self.assertEquals(with_manager.__exit__(MyException2, + self.assertEqual(with_manager.__exit__(MyException2, MyException2(), None), None) self.assertTrue(isinstance(cm.exception, MyException2)) @@ -932,7 +932,7 @@ raise MyException(*args) error = self.test.failUnlessRaisesRegexp(MyException, "rror:.*foo", f, 1, "foo") - self.assertEquals(error.args, (1, "foo")) + self.assertEqual(error.args, (1, "foo")) def test_fail_unless_raises_regexp_doesnt_match(self): class MyException(Exception): @@ -943,8 +943,8 @@ try: self.test.failUnlessRaisesRegexp(MyException, "Foo:.*foo", f, 1, "foo") - except AssertionError, e: - self.assertEquals(str(e), + except AssertionError as e: + self.assertEqual(str(e), '"Error: (1, \'foo\')" doesn\'t match ' '\'Foo:.*foo\'') else: @@ -955,8 +955,8 @@ return args try: self.test.failUnlessRaisesRegexp(ValueError, "blah", f, 1, "foo") - except AssertionError, e: - self.assertEquals( + except AssertionError as e: + self.assertEqual( str(e), "ValueError not raised ((1, 'foo') returned)") else: @@ -982,10 +982,10 @@ return "Error: " + str(self.args) with_manager = self.test.failUnlessRaisesRegexp(MyException, "rror.*f") cm = with_manager.__enter__() - self.assertEquals(with_manager.__exit__(MyException, + self.assertEqual(with_manager.__exit__(MyException, MyException(1, "foo"), None), True) - self.assertEquals(cm.exception.args, (1, "foo")) + self.assertEqual(cm.exception.args, (1, "foo")) def test_fail_unless_raises_regexp_context_doesnt_match(self): class MyException(Exception): @@ -995,10 +995,10 @@ cm = with_manager.__enter__() try: with_manager.__exit__(MyException, MyException(1, "foo"), None) - except AssertionError, e: - self.assertEquals(str(e), + except AssertionError as e: + self.assertEqual(str(e), '"Error: (1, \'foo\')" doesn\'t match \'oo.*f\'') - self.assertEquals(cm.exception.args, (1, "foo")) + self.assertEqual(cm.exception.args, (1, "foo")) else: self.fail("AssertionError not raised") @@ -1007,9 +1007,9 @@ cm = with_manager.__enter__() try: with_manager.__exit__(None, None, None) - except AssertionError, e: - self.assertEquals(str(e), "ValueError not raised") - self.assertEquals(cm.exception, None) + except AssertionError as e: + self.assertEqual(str(e), "ValueError not raised") + self.assertEqual(cm.exception, None) else: self.fail("AssertionError not raised") @@ -1020,7 +1020,7 @@ pass with_manager = self.test.failUnlessRaisesRegexp(MyException1, "blah") cm = with_manager.__enter__() - self.assertEquals(with_manager.__exit__(MyException2, + self.assertEqual(with_manager.__exit__(MyException2, MyException2(), None), None) self.assertTrue(isinstance(cm.exception, MyException2)) @@ -1034,8 +1034,8 @@ obj = C() try: self.test.failUnlessIsInstance(obj, D) - except AssertionError, e: - self.assertEquals(str(e), " is not an instance of D") + except AssertionError as e: + self.assertEqual(str(e), " is not an instance of D") else: self.fail("AssertionError not raised") @@ -1045,8 +1045,8 @@ obj = C() try: self.test.failUnlessIsInstance(obj, D, "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -1065,8 +1065,8 @@ obj = C() try: self.test.failIfIsInstance(obj, C) - except AssertionError, e: - self.assertEquals(str(e), " is an instance of C") + except AssertionError as e: + self.assertEqual(str(e), " is an instance of C") else: self.fail("AssertionError not raised") @@ -1075,8 +1075,8 @@ obj = C() try: self.test.failIfIsInstance(obj, C, "oops!") - except AssertionError, e: - self.assertEquals(str(e), "oops!") + except AssertionError as e: + self.assertEqual(str(e), "oops!") else: self.fail("AssertionError not raised") @@ -1092,76 +1092,76 @@ def test_aliases(self): get_method = MockerTestCase.__dict__.get - self.assertEquals(get_method("assertIs"), + self.assertEqual(get_method("assertIs"), get_method("failUnlessIs")) - self.assertEquals(get_method("assertIsNot"), + self.assertEqual(get_method("assertIsNot"), get_method("failIfIs")) - self.assertEquals(get_method("assertIn"), + self.assertEqual(get_method("assertIn"), get_method("failUnlessIn")) - self.assertEquals(get_method("assertNotIn"), + self.assertEqual(get_method("assertNotIn"), get_method("failIfIn")) - self.assertEquals(get_method("assertStartsWith"), + self.assertEqual(get_method("assertStartsWith"), get_method("failUnlessStartsWith")) - self.assertEquals(get_method("assertNotStartsWith"), + self.assertEqual(get_method("assertNotStartsWith"), get_method("failIfStartsWith")) - self.assertEquals(get_method("assertEndsWith"), + self.assertEqual(get_method("assertEndsWith"), get_method("failUnlessEndsWith")) - self.assertEquals(get_method("assertNotEndsWith"), + self.assertEqual(get_method("assertNotEndsWith"), get_method("failIfEndsWith")) - self.assertEquals(get_method("assertApproximates"), + self.assertEqual(get_method("assertApproximates"), get_method("failUnlessApproximates")) - self.assertEquals(get_method("assertNotApproximates"), + self.assertEqual(get_method("assertNotApproximates"), get_method("failIfApproximates")) - self.assertEquals(get_method("assertMethodsMatch"), + self.assertEqual(get_method("assertMethodsMatch"), get_method("failUnlessMethodsMatch")) - self.assertEquals(get_method("assertRaises"), + self.assertEqual(get_method("assertRaises"), get_method("failUnlessRaises")) - self.assertEquals(get_method("assertRaisesRegexp"), + self.assertEqual(get_method("assertRaisesRegexp"), get_method("failUnlessRaisesRegexp")) - self.assertEquals(get_method("assertIsInstance"), + self.assertEqual(get_method("assertIsInstance"), get_method("failUnlessIsInstance")) - self.assertEquals(get_method("assertIsNotInstance"), + self.assertEqual(get_method("assertIsNotInstance"), get_method("failIfIsInstance")) # Poor choice in Python 2.7/3.2+. - self.assertEquals(get_method("assertNotIsInstance"), + self.assertEqual(get_method("assertNotIsInstance"), get_method("failIfIsInstance")) def test_twisted_trial_aliases(self): get_method = MockerTestCase.__dict__.get - self.assertEquals(get_method("assertIdentical"), + self.assertEqual(get_method("assertIdentical"), get_method("assertIs")) - self.assertEquals(get_method("assertNotIdentical"), + self.assertEqual(get_method("assertNotIdentical"), get_method("assertIsNot")) - self.assertEquals(get_method("failUnlessIdentical"), + self.assertEqual(get_method("failUnlessIdentical"), get_method("failUnlessIs")) - self.assertEquals(get_method("failIfIdentical"), + self.assertEqual(get_method("failIfIdentical"), get_method("failIfIs")) def test_missing_python23_aliases(self): - self.assertEquals(MockerTestCase.assertTrue.im_func, - MockerTestCase.failUnless.im_func) - - self.assertEquals(MockerTestCase.assertFalse.im_func, - MockerTestCase.failIf.im_func) + self.assertEqual(MockerTestCase.assertTrue.__func__, + MockerTestCase.assertTrue.__func__) + + self.assertEqual(MockerTestCase.assertFalse.__func__, + MockerTestCase.assertFalse.__func__) def test_make_file_returns_writable_filename(self): filename = self.test.makeFile() @@ -1170,12 +1170,12 @@ def test_make_file_creates_file(self): filename = self.test.makeFile("") - self.assertEquals(os.path.getsize(filename), 0) + self.assertEqual(os.path.getsize(filename), 0) def test_make_file_cleansup_on_success(self): filename = self.test.makeFile() self.test.run() - self.assertEquals(os.path.isfile(filename), False) + self.assertEqual(os.path.isfile(filename), False) def test_make_file_cleansup_on_failure(self): class MyTest(MockerTestCase): @@ -1184,11 +1184,11 @@ test = MyTest("test_method") filename = test.makeFile() test.run() - self.assertEquals(os.path.isfile(filename), False) + self.assertEqual(os.path.isfile(filename), False) def test_make_file_with_content(self): filename = self.test.makeFile("content") - self.assertEquals(open(filename).read(), "content") + self.assertEqual(open(filename).read(), "content") def test_make_file_with_prefix(self): filename = self.test.makeFile(prefix="prefix-") @@ -1202,13 +1202,13 @@ dirname = tempfile.mkdtemp() try: filename = self.test.makeFile(dirname=dirname) - self.assertEquals(os.path.dirname(filename), dirname) + self.assertEqual(os.path.dirname(filename), dirname) finally: shutil.rmtree(dirname) def test_make_file_with_basename(self): filename = self.test.makeFile(basename="basename") - self.assertEquals(os.path.basename(filename), "basename") + self.assertEqual(os.path.basename(filename), "basename") self.test.run() self.assertFalse(os.path.exists(filename)) @@ -1216,8 +1216,8 @@ dirname = tempfile.mkdtemp() try: filename = self.test.makeFile(dirname=dirname, basename="basename") - self.assertEquals(os.path.dirname(filename), dirname) - self.assertEquals(os.path.basename(filename), "basename") + self.assertEqual(os.path.dirname(filename), dirname) + self.assertEqual(os.path.basename(filename), "basename") finally: shutil.rmtree(dirname) @@ -1225,8 +1225,8 @@ path = tempfile.mktemp() try: filename = self.test.makeFile("", path=path) - self.assertEquals(filename, path) - self.assertEquals(os.path.getsize(filename), 0) + self.assertEqual(filename, path) + self.assertEqual(os.path.getsize(filename), 0) self.test.run() self.assertFalse(os.path.exists(filename)) finally: @@ -1235,12 +1235,12 @@ def test_make_dir_returns_dirname(self): dirname = self.test.makeDir() - self.assertEquals(os.path.isdir(dirname), True) + self.assertEqual(os.path.isdir(dirname), True) def test_make_dir_cleansup_on_success(self): dirname = self.test.makeDir() self.test.run() - self.assertEquals(os.path.isdir(dirname), False) + self.assertEqual(os.path.isdir(dirname), False) def test_make_dir_cleansup_on_failure(self): class MyTest(MockerTestCase): @@ -1249,7 +1249,7 @@ test = MyTest("test_method") dirname = test.makeDir() test.run() - self.assertEquals(os.path.isdir(dirname), False) + self.assertEqual(os.path.isdir(dirname), False) def test_make_dir_with_prefix(self): dirname = self.test.makeDir(prefix="prefix-") @@ -1263,7 +1263,7 @@ dirname = tempfile.mkdtemp() try: path = self.test.makeDir(dirname=dirname) - self.assertEquals(os.path.dirname(path), dirname) + self.assertEqual(os.path.dirname(path), dirname) finally: if os.path.exists(dirname): shutil.rmtree(dirname) @@ -1271,10 +1271,10 @@ def test_make_dir_with_path(self): path = tempfile.mktemp() try: - self.assertEquals(self.test.makeDir(path=path), path) - self.assertEquals(os.path.isdir(path), True) + self.assertEqual(self.test.makeDir(path=path), path) + self.assertEqual(os.path.isdir(path), True) self.test.run() - self.assertEquals(os.path.isdir(path), False) + self.assertEqual(os.path.isdir(path), False) finally: if os.path.exists(path): shutil.rmtree(path) @@ -1302,8 +1302,8 @@ result = unittest.TestResult() MyTest("test_method").run(result) - self.assertEquals(result.errors, []) - self.assertEquals(result.failures, []) + self.assertEqual(result.errors, []) + self.assertEqual(result.failures, []) @@ -1331,9 +1331,9 @@ task.restore = lambda: calls.append("restore") self.mocker.replay() self.assertFalse(self.mocker.is_recording()) - self.assertEquals(calls, ["replay"]) + self.assertEqual(calls, ["replay"]) self.mocker.replay() - self.assertEquals(calls, ["replay", "restore", "replay"]) + self.assertEqual(calls, ["replay", "restore", "replay"]) def test_restore(self): calls = [] @@ -1345,7 +1345,7 @@ self.mocker.restore() self.mocker.restore() self.assertTrue(self.mocker.is_recording()) - self.assertEquals(calls, ["replay", "restore"]) + self.assertEqual(calls, ["replay", "restore"]) def test_reset(self): calls = [] @@ -1355,8 +1355,8 @@ self.mocker.replay() self.mocker.reset() self.mocker.reset() - self.assertEquals(calls, ["restore"]) - self.assertEquals(self.mocker.get_events(), []) + self.assertEqual(calls, ["restore"]) + self.assertEqual(self.mocker.get_events(), []) def test_reset_removes_ordering(self): self.mocker.order() @@ -1379,7 +1379,7 @@ try: self.mocker.verify() - except AssertionError, e: + except AssertionError as e: message = os.linesep.join(["[Mocker] Unmet expectations:", "", "=> 1 failed", @@ -1390,7 +1390,7 @@ " - Line 1", " - Line 2", ""]) - self.assertEquals(str(e), message) + self.assertEqual(str(e), message) else: self.fail("AssertionError not raised") @@ -1417,17 +1417,17 @@ event = MyEvent() self.mocker.add_event(event) - self.assertEquals(calls, []) + self.assertEqual(calls, []) mocker = self.mocker.__enter__() self.assertTrue(mocker is self.mocker) - self.assertEquals(calls, ["replay"]) + self.assertEqual(calls, ["replay"]) # Verify without errors. del calls[:] result = self.mocker.__exit__(None, None, None) - self.assertEquals(result, False) - self.assertEquals(calls, ["restore", "verify"]) + self.assertEqual(result, False) + self.assertEqual(calls, ["restore", "verify"]) throw = True @@ -1436,37 +1436,37 @@ del calls[:] self.assertRaises(AssertionError, self.mocker.__exit__, None, None, None) - self.assertEquals(calls, ["restore", "verify"]) + self.assertEqual(calls, ["restore", "verify"]) # An exception happened in the 'with' block. Verify won't raise. self.mocker.replay() del calls[:] result = self.mocker.__exit__(AssertionError, None, None) - self.assertEquals(result, False) - self.assertEquals(calls, ["restore"]) + self.assertEqual(result, False) + self.assertEqual(calls, ["restore"]) def test_add_recorder_on_instance(self): obj1 = object() obj2 = object() mocker = CleanMocker() - self.assertEquals(mocker.add_recorder(obj1), obj1) - self.assertEquals(mocker.add_recorder(obj2), obj2) - self.assertEquals(mocker.get_recorders(), [obj1, obj2]) + self.assertEqual(mocker.add_recorder(obj1), obj1) + self.assertEqual(mocker.add_recorder(obj2), obj2) + self.assertEqual(mocker.get_recorders(), [obj1, obj2]) mocker = CleanMocker() - self.assertEquals(mocker.add_recorder(obj1), obj1) - self.assertEquals(mocker.get_recorders(), [obj1]) + self.assertEqual(mocker.add_recorder(obj1), obj1) + self.assertEqual(mocker.get_recorders(), [obj1]) def test_add_recorder_on_class(self): class MyMocker(CleanMocker): pass obj1 = object() obj2 = object() - self.assertEquals(MyMocker.add_recorder(obj1), obj1) - self.assertEquals(MyMocker.add_recorder(obj2), obj2) + self.assertEqual(MyMocker.add_recorder(obj1), obj1) + self.assertEqual(MyMocker.add_recorder(obj2), obj2) mocker = MyMocker() - self.assertEquals(mocker.get_recorders(), [obj1, obj2]) + self.assertEqual(mocker.get_recorders(), [obj1, obj2]) mocker = MyMocker() - self.assertEquals(mocker.get_recorders(), [obj1, obj2]) + self.assertEqual(mocker.get_recorders(), [obj1, obj2]) def test_add_recorder_on_subclass(self): class MyMocker1(CleanMocker): @@ -1477,8 +1477,8 @@ pass obj2 = object() MyMocker2.add_recorder(obj2) - self.assertEquals(MyMocker1.get_recorders(), [obj1]) - self.assertEquals(MyMocker2.get_recorders(), [obj1, obj2]) + self.assertEqual(MyMocker1.get_recorders(), [obj1]) + self.assertEqual(MyMocker2.get_recorders(), [obj1, obj2]) def test_remove_recorder_on_instance(self): obj1 = object() @@ -1491,116 +1491,116 @@ MyMocker.add_recorder(obj3) mocker = MyMocker() mocker.remove_recorder(obj2) - self.assertEquals(mocker.get_recorders(), [obj1, obj3]) - self.assertEquals(MyMocker.get_recorders(), [obj1, obj2, obj3]) + self.assertEqual(mocker.get_recorders(), [obj1, obj3]) + self.assertEqual(MyMocker.get_recorders(), [obj1, obj2, obj3]) def test_remove_recorder_on_class(self): class MyMocker(CleanMocker): pass obj1 = object() obj2 = object() - self.assertEquals(MyMocker.add_recorder(obj1), obj1) - self.assertEquals(MyMocker.add_recorder(obj2), obj2) + self.assertEqual(MyMocker.add_recorder(obj1), obj1) + self.assertEqual(MyMocker.add_recorder(obj2), obj2) MyMocker.remove_recorder(obj1) - self.assertEquals(MyMocker.get_recorders(), [obj2]) + self.assertEqual(MyMocker.get_recorders(), [obj2]) def test_mock(self): mock = self.mocker.mock() - self.assertEquals(mock.__mocker_name__, None) - self.assertEquals(mock.__mocker_spec__, None) - self.assertEquals(mock.__mocker_type__, None) - self.assertEquals(mock.__mocker_count__, True) + self.assertEqual(mock.__mocker_name__, None) + self.assertEqual(mock.__mocker_spec__, None) + self.assertEqual(mock.__mocker_type__, None) + self.assertEqual(mock.__mocker_count__, True) def test_mock_with_name(self): mock = self.mocker.mock(name="name") - self.assertEquals(mock.__mocker_name__, "name") + self.assertEqual(mock.__mocker_name__, "name") def test_mock_with_spec(self): class C(object): pass mock = self.mocker.mock(spec=C) - self.assertEquals(mock.__mocker_spec__, C) + self.assertEqual(mock.__mocker_spec__, C) def test_mock_with_type(self): class C(object): pass mock = self.mocker.mock(type=C) - self.assertEquals(mock.__mocker_type__, C) + self.assertEqual(mock.__mocker_type__, C) def test_mock_with_spec_and_type(self): class C(object): pass mock = self.mocker.mock(C) - self.assertEquals(mock.__mocker_spec__, C) - self.assertEquals(mock.__mocker_type__, C) + self.assertEqual(mock.__mocker_spec__, C) + self.assertEqual(mock.__mocker_type__, C) def test_mock_with_count(self): class C(object): pass mock = self.mocker.mock(count=False) - self.assertEquals(mock.__mocker_count__, False) + self.assertEqual(mock.__mocker_count__, False) def test_proxy(self): original = object() mock = self.mocker.proxy(original) - self.assertEquals(type(mock), Mock) - self.assertEquals(mock.__mocker_object__, original) - self.assertEquals(mock.__mocker_path__.root_object, original) - self.assertEquals(mock.__mocker_count__, True) + self.assertEqual(type(mock), Mock) + self.assertEqual(mock.__mocker_object__, original) + self.assertEqual(mock.__mocker_path__.root_object, original) + self.assertEqual(mock.__mocker_count__, True) def test_proxy_with_count(self): original = object() mock = self.mocker.proxy(original, count=False) - self.assertEquals(mock.__mocker_count__, False) + self.assertEqual(mock.__mocker_count__, False) def test_proxy_with_spec(self): original = object() class C(object): pass mock = self.mocker.proxy(original, C) - self.assertEquals(mock.__mocker_object__, original) - self.assertEquals(mock.__mocker_spec__, C) + self.assertEqual(mock.__mocker_object__, original) + self.assertEqual(mock.__mocker_spec__, C) def test_proxy_with_type(self): original = object() class C(object): pass mock = self.mocker.proxy(original, type=C) - self.assertEquals(mock.__mocker_type__, C) + self.assertEqual(mock.__mocker_type__, C) def test_proxy_spec_defaults_to_the_object_itself(self): original = object() mock = self.mocker.proxy(original) - self.assertEquals(mock.__mocker_spec__, original) + self.assertEqual(mock.__mocker_spec__, original) def test_proxy_type_defaults_to_the_object_type(self): original = object() mock = self.mocker.proxy(original) - self.assertEquals(mock.__mocker_type__, object) + self.assertEqual(mock.__mocker_type__, object) def test_proxy_with_spec_and_type_none(self): original = object() mock = self.mocker.proxy(original, spec=None, type=None) - self.assertEquals(mock.__mocker_spec__, None) - self.assertEquals(mock.__mocker_type__, None) + self.assertEqual(mock.__mocker_spec__, None) + self.assertEqual(mock.__mocker_type__, None) def test_proxy_with_passthrough_false(self): original = object() class C(object): pass mock = self.mocker.proxy(original, C, passthrough=False) - self.assertEquals(mock.__mocker_object__, original) - self.assertEquals(mock.__mocker_spec__, C) - self.assertEquals(mock.__mocker_passthrough__, False) + self.assertEqual(mock.__mocker_object__, original) + self.assertEqual(mock.__mocker_spec__, C) + self.assertEqual(mock.__mocker_passthrough__, False) def test_proxy_with_submodule_string(self): from os import path module = self.mocker.proxy("os.path") - self.assertEquals(type(module), Mock) - self.assertEquals(type(module.__mocker_object__), ModuleType) - self.assertEquals(module.__mocker_name__, "os.path") - self.assertEquals(module.__mocker_object__, path) + self.assertEqual(type(module), Mock) + self.assertEqual(type(module.__mocker_object__), ModuleType) + self.assertEqual(module.__mocker_name__, "os.path") + self.assertEqual(module.__mocker_object__, path) def test_proxy_with_module_function_string(self): mock = self.mocker.proxy("os.path.join.func_name") - self.assertEquals(mock.__mocker_object__, "join") + self.assertEqual(mock.__mocker_object__, "join") def test_proxy_with_string_and_name(self): module = self.mocker.proxy("os.path", name="mock") - self.assertEquals(module.__mocker_name__, "mock") + self.assertEqual(module.__mocker_name__, "mock") def test_proxy_with_unexistent_module(self): self.assertRaises(ImportError, self.mocker.proxy, "unexistent.module") @@ -1609,16 +1609,16 @@ obj = object() proxy = self.mocker.replace(obj, spec=object, name="obj", count=False, passthrough=False) - self.assertEquals(type(proxy), Mock) - self.assertEquals(type(proxy.__mocker_object__), object) - self.assertEquals(proxy.__mocker_object__, obj) - self.assertEquals(proxy.__mocker_spec__, object) - self.assertEquals(proxy.__mocker_name__, "obj") - self.assertEquals(proxy.__mocker_count__, False) + self.assertEqual(type(proxy), Mock) + self.assertEqual(type(proxy.__mocker_object__), object) + self.assertEqual(proxy.__mocker_object__, obj) + self.assertEqual(proxy.__mocker_spec__, object) + self.assertEqual(proxy.__mocker_name__, "obj") + self.assertEqual(proxy.__mocker_count__, False) (event,) = self.mocker.get_events() - self.assertEquals(type(event), ReplayRestoreEvent) + self.assertEqual(type(event), ReplayRestoreEvent) (task,) = event.get_tasks() - self.assertEquals(type(task), ProxyReplacer) + self.assertEqual(type(task), ProxyReplacer) self.assertTrue(task.mock is proxy) self.assertTrue(task.mock.__mocker_object__ is obj) self.assertTrue(proxy is not obj) @@ -1626,84 +1626,84 @@ def test_replace_with_submodule_string(self): from os import path module = self.mocker.replace("os.path") - self.assertEquals(type(module), Mock) - self.assertEquals(type(module.__mocker_object__), ModuleType) - self.assertEquals(module.__mocker_name__, "os.path") - self.assertEquals(module.__mocker_object__, path) + self.assertEqual(type(module), Mock) + self.assertEqual(type(module.__mocker_object__), ModuleType) + self.assertEqual(module.__mocker_name__, "os.path") + self.assertEqual(module.__mocker_object__, path) (event,) = self.mocker.get_events() (task,) = event.get_tasks() - self.assertEquals(type(task), ProxyReplacer) + self.assertEqual(type(task), ProxyReplacer) self.assertTrue(task.mock is module) self.assertTrue(task.mock.__mocker_object__ is path) self.assertTrue(module is not path) def test_replace_with_module_function_string(self): mock = self.mocker.replace("os.path.join.func_name") - self.assertEquals(mock.__mocker_object__, "join") + self.assertEqual(mock.__mocker_object__, "join") def test_replace_with_string_and_name(self): module = self.mocker.replace("os.path", name="mock") - self.assertEquals(module.__mocker_name__, "mock") + self.assertEqual(module.__mocker_name__, "mock") def test_replace_with_type(self): original = object() class C(object): pass mock = self.mocker.replace(original, type=C) - self.assertEquals(mock.__mocker_type__, C) + self.assertEqual(mock.__mocker_type__, C) def test_replace_spec_defaults_to_the_object_itself(self): original = object() mock = self.mocker.replace(original) - self.assertEquals(mock.__mocker_spec__, original) + self.assertEqual(mock.__mocker_spec__, original) def test_replace_type_defaults_to_the_object_type(self): original = object() mock = self.mocker.replace(original) - self.assertEquals(mock.__mocker_type__, object) + self.assertEqual(mock.__mocker_type__, object) def test_replace_with_spec_and_type_none(self): original = object() mock = self.mocker.replace(original, spec=None, type=None) - self.assertEquals(mock.__mocker_spec__, None) - self.assertEquals(mock.__mocker_type__, None) + self.assertEqual(mock.__mocker_spec__, None) + self.assertEqual(mock.__mocker_type__, None) def test_replace_with_passthrough_false(self): original = object() class C(object): pass mock = self.mocker.replace(original, passthrough=False) - self.assertEquals(mock.__mocker_passthrough__, False) + self.assertEqual(mock.__mocker_passthrough__, False) def test_replace_with_bound_method(self): - from Queue import Queue + from queue import Queue mock = self.mocker.replace(Queue.empty) - self.assertEquals(mock.__mocker_object__, Queue.empty.im_func) + self.assertEqual(mock.__mocker_object__, Queue.empty.__func__) def test_add_and_get_event(self): self.mocker.add_event(41) - self.assertEquals(self.mocker.add_event(42), 42) - self.assertEquals(self.mocker.get_events(), [41, 42]) + self.assertEqual(self.mocker.add_event(42), 42) + self.assertEqual(self.mocker.get_events(), [41, 42]) def test_recording(self): obj = self.mocker.mock() obj.attr() - self.assertEquals(len(self.recorded), 2) + self.assertEqual(len(self.recorded), 2) action1 = Action("getattr", ("attr",), {}) action2 = Action("call", (), {}) mocker1, event1 = self.recorded[0] - self.assertEquals(mocker1, self.mocker) - self.assertEquals(type(event1), Event) + self.assertEqual(mocker1, self.mocker) + self.assertEqual(type(event1), Event) self.assertTrue(event1.path.matches(Path(obj, None, [action1]))) mocker2, event2 = self.recorded[1] - self.assertEquals(mocker2, self.mocker) - self.assertEquals(type(event2), Event) + self.assertEqual(mocker2, self.mocker) + self.assertEqual(type(event2), Event) self.assertTrue(event2.path.matches(Path(obj, None, [action1, action2]))) - self.assertEquals(self.mocker.get_events(), [event1, event2]) + self.assertEqual(self.mocker.get_events(), [event1, event2]) def test_recording_result_path(self): obj = self.mocker.mock() @@ -1716,11 +1716,11 @@ self.mocker.replay() try: self.mocker.act(self.path) - except AssertionError, e: + except AssertionError as e: pass else: self.fail("AssertionError not raised") - self.assertEquals(str(e), "[Mocker] Unexpected expression: mock.attr") + self.assertEqual(str(e), "[Mocker] Unexpected expression: mock.attr") def test_replaying_matching(self): calls = [] @@ -1737,8 +1737,8 @@ event.add_task(MyTask()) self.mocker.add_event(event) self.mocker.replay() - self.assertEquals(self.mocker.act(self.path), "result") - self.assertEquals(calls, ["matches", "run"]) + self.assertEqual(self.mocker.act(self.path), "result") + self.assertEqual(calls, ["matches", "run"]) def test_replaying_none_matching(self): calls = [] @@ -1752,7 +1752,7 @@ self.mocker.add_event(event) self.mocker.replay() self.assertRaises(AssertionError, self.mocker.act, self.path) - self.assertEquals(calls, ["matches"]) + self.assertEqual(calls, ["matches"]) def test_replay_order(self): """ @@ -1799,26 +1799,26 @@ # Labels: [M]ay run, [S]atisfied, [H]as run # State: 1=S 2=S 3= 4=MS 5=S - self.assertEquals(self.mocker.act(self.path), "MyTask4") + self.assertEqual(self.mocker.act(self.path), "MyTask4") # State: 1=S 2=S 3= 4=MSH 5=S - self.assertEquals(self.mocker.act(self.path), "MyTask4") + self.assertEqual(self.mocker.act(self.path), "MyTask4") # State: 1=MS 2=MS 3=M 4=MSH 5=MS - self.assertEquals(self.mocker.act(self.path), "MyTask3") + self.assertEqual(self.mocker.act(self.path), "MyTask3") # State: 1=MS 2=MS 3=MSH 4=MSH 5=MS - self.assertEquals(self.mocker.act(self.path), "MyTask1") + self.assertEqual(self.mocker.act(self.path), "MyTask1") # State: 1=MSH 2=MS 3=MSH 4=MSH 5=MS - self.assertEquals(self.mocker.act(self.path), "MyTask2") + self.assertEqual(self.mocker.act(self.path), "MyTask2") # State: 1=MSH 2=MSH 3=MSH 4=MSH 5=MS - self.assertEquals(self.mocker.act(self.path), "MyTask5") + self.assertEqual(self.mocker.act(self.path), "MyTask5") # State: 1=MSH 2=MSH 3=MSH 4=MSH 5=MSH - self.assertEquals(self.mocker.act(self.path), "MyTask1") + self.assertEqual(self.mocker.act(self.path), "MyTask1") def test_recorder_decorator(self): result = recorder(42) try: - self.assertEquals(result, 42) - self.assertEquals(Mocker.get_recorders()[-1], 42) - self.assertEquals(MockerBase.get_recorders(), []) + self.assertEqual(result, 42) + self.assertEqual(Mocker.get_recorders()[-1], 42) + self.assertEqual(MockerBase.get_recorders(), []) finally: Mocker.remove_recorder(42) @@ -1826,7 +1826,7 @@ event1 = self.mocker.add_event(Event()) event2 = self.mocker.add_event(Event()) self.mocker.result(123) - self.assertEquals(event2.run(self.path), 123) + self.assertEqual(event2.run(self.path), 123) def test_throw(self): class MyException(Exception): pass @@ -1839,7 +1839,7 @@ event1 = self.mocker.add_event(Event()) event2 = self.mocker.add_event(Event()) self.mocker.call(lambda *args, **kwargs: 123) - self.assertEquals(event2.run(self.path), 123) + self.assertEqual(event2.run(self.path), 123) def test_call_with_object(self): obj = object() @@ -1850,10 +1850,10 @@ event2 = self.mocker.add_event(Event(path)) self.mocker.call(lambda *args, **kwargs: (args, kwargs), with_object=True) - self.assertEquals(event1.get_tasks(), []) + self.assertEqual(event1.get_tasks(), []) (task,) = event2.get_tasks() - self.assertEquals(type(task), FunctionRunner) - self.assertEquals(event2.run(event2.path), ((456, "attr"), {})) + self.assertEqual(type(task), FunctionRunner) + self.assertEqual(event2.run(event2.path), ((456, "attr"), {})) def test_call_with_object_needs_proxy(self): obj = object() @@ -1864,10 +1864,10 @@ event2 = self.mocker.add_event(Event(path)) self.mocker.call(lambda *args, **kwargs: (args, kwargs), with_object=True) - self.assertEquals(event1.get_tasks(), []) + self.assertEqual(event1.get_tasks(), []) (task,) = event2.get_tasks() - self.assertEquals(type(task), FunctionRunner) - self.assertEquals(event2.run(event2.path), ((456, "attr"), {})) + self.assertEqual(type(task), FunctionRunner) + self.assertEqual(event2.run(event2.path), ((456, "attr"), {})) def test_call_with_object_fails_on_unproxied(self): mock = self.mocker.mock() @@ -1885,19 +1885,19 @@ event2.add_task(ImplicitRunCounter(1)) event2.add_task(ImplicitRunCounter(1)) self.mocker.count(2, 3) - self.assertEquals(len(event1.get_tasks()), 0) + self.assertEqual(len(event1.get_tasks()), 0) (task1, task2,) = event2.get_tasks() - self.assertEquals(type(task1), RunCounter) - self.assertEquals(type(task2), MyTask) - self.assertEquals(task1.min, 2) - self.assertEquals(task1.max, 3) + self.assertEqual(type(task1), RunCounter) + self.assertEqual(type(task2), MyTask) + self.assertEqual(task1.min, 2) + self.assertEqual(task1.max, 3) self.mocker.count(4) - self.assertEquals(len(event1.get_tasks()), 0) + self.assertEqual(len(event1.get_tasks()), 0) (task1, task2) = event2.get_tasks() - self.assertEquals(type(task1), RunCounter) - self.assertEquals(type(task2), MyTask) - self.assertEquals(task1.min, 4) - self.assertEquals(task1.max, 4) + self.assertEqual(type(task1), RunCounter) + self.assertEqual(type(task2), MyTask) + self.assertEqual(task1.min, 4) + self.assertEqual(task1.max, 4) def test_count_without_implicit_counter(self): class MyTask(Task): @@ -1906,12 +1906,12 @@ event2 = self.mocker.add_event(Event()) event2.add_task(MyTask()) self.mocker.count(2, 3) - self.assertEquals(len(event1.get_tasks()), 0) + self.assertEqual(len(event1.get_tasks()), 0) (task1, task2,) = event2.get_tasks() - self.assertEquals(type(task1), RunCounter) - self.assertEquals(type(task2), MyTask) - self.assertEquals(task1.min, 2) - self.assertEquals(task1.max, 3) + self.assertEqual(type(task1), RunCounter) + self.assertEqual(type(task2), MyTask) + self.assertEqual(task1.min, 2) + self.assertEqual(task1.max, 3) def test_order(self): mock1 = self.mocker.mock() @@ -1932,35 +1932,35 @@ self.mocker.order(result1, result4) self.mocker.order(result2, result4) events = self.mocker.get_events() - self.assertEquals(len(events), 8) - - self.assertEquals(events[0].get_tasks(), [other_task]) + self.assertEqual(len(events), 8) + + self.assertEqual(events[0].get_tasks(), [other_task]) other_task_, task1 = events[1].get_tasks() - self.assertEquals(type(task1), Orderer) - self.assertEquals(task1.path, events[1].path) - self.assertEquals(task1.get_dependencies(), []) - self.assertEquals(other_task_, other_task) - - self.assertEquals(events[2].get_tasks(), [other_task]) + self.assertEqual(type(task1), Orderer) + self.assertEqual(task1.path, events[1].path) + self.assertEqual(task1.get_dependencies(), []) + self.assertEqual(other_task_, other_task) + + self.assertEqual(events[2].get_tasks(), [other_task]) other_task_, task3 = events[3].get_tasks() - self.assertEquals(type(task3), Orderer) - self.assertEquals(task3.path, events[3].path) - self.assertEquals(task3.get_dependencies(), [task1]) - self.assertEquals(other_task_, other_task) - - self.assertEquals(events[4].get_tasks(), [other_task]) + self.assertEqual(type(task3), Orderer) + self.assertEqual(task3.path, events[3].path) + self.assertEqual(task3.get_dependencies(), [task1]) + self.assertEqual(other_task_, other_task) + + self.assertEqual(events[4].get_tasks(), [other_task]) other_task_, task5 = events[5].get_tasks() - self.assertEquals(type(task5), Orderer) - self.assertEquals(task5.path, events[5].path) - self.assertEquals(task5.get_dependencies(), [task3]) - self.assertEquals(other_task_, other_task) - - self.assertEquals(events[6].get_tasks(), [other_task]) + self.assertEqual(type(task5), Orderer) + self.assertEqual(task5.path, events[5].path) + self.assertEqual(task5.get_dependencies(), [task3]) + self.assertEqual(other_task_, other_task) + + self.assertEqual(events[6].get_tasks(), [other_task]) other_task_, task7 = events[7].get_tasks() - self.assertEquals(type(task7), Orderer) - self.assertEquals(task7.path, events[7].path) - self.assertEquals(task7.get_dependencies(), [task1, task3]) - self.assertEquals(other_task_, other_task) + self.assertEqual(type(task7), Orderer) + self.assertEqual(task7.path, events[7].path) + self.assertEqual(task7.get_dependencies(), [task1, task3]) + self.assertEqual(other_task_, other_task) def test_after(self): mock1 = self.mocker.mock() @@ -1978,28 +1978,28 @@ self.mocker.after(result1, result2) events = self.mocker.get_events() - self.assertEquals(len(events), 6) - - self.assertEquals(events[0].get_tasks(), [other_task]) + self.assertEqual(len(events), 6) + + self.assertEqual(events[0].get_tasks(), [other_task]) other_task_, task1 = events[1].get_tasks() - self.assertEquals(type(task1), Orderer) - self.assertEquals(task1.path, events[1].path) - self.assertEquals(task1.get_dependencies(), []) - self.assertEquals(other_task_, other_task) - - self.assertEquals(events[2].get_tasks(), [other_task]) + self.assertEqual(type(task1), Orderer) + self.assertEqual(task1.path, events[1].path) + self.assertEqual(task1.get_dependencies(), []) + self.assertEqual(other_task_, other_task) + + self.assertEqual(events[2].get_tasks(), [other_task]) other_task_, task3 = events[3].get_tasks() - self.assertEquals(type(task3), Orderer) - self.assertEquals(task3.path, events[3].path) - self.assertEquals(task3.get_dependencies(), []) - self.assertEquals(other_task_, other_task) - - self.assertEquals(events[4].get_tasks(), [other_task]) + self.assertEqual(type(task3), Orderer) + self.assertEqual(task3.path, events[3].path) + self.assertEqual(task3.get_dependencies(), []) + self.assertEqual(other_task_, other_task) + + self.assertEqual(events[4].get_tasks(), [other_task]) other_task_, task5 = events[5].get_tasks() - self.assertEquals(type(task5), Orderer) - self.assertEquals(task5.path, events[5].path) - self.assertEquals(task5.get_dependencies(), [task1, task3]) - self.assertEquals(other_task_, other_task) + self.assertEqual(type(task5), Orderer) + self.assertEqual(task5.path, events[5].path) + self.assertEqual(task5.get_dependencies(), [task1, task3]) + self.assertEqual(other_task_, other_task) def test_before(self): mock1 = self.mocker.mock() @@ -2017,48 +2017,48 @@ self.mocker.before(result1, result2) events = self.mocker.get_events() - self.assertEquals(len(events), 6) - - self.assertEquals(events[4].get_tasks(), [other_task]) + self.assertEqual(len(events), 6) + + self.assertEqual(events[4].get_tasks(), [other_task]) other_task_, task5 = events[5].get_tasks() - self.assertEquals(type(task5), Orderer) - self.assertEquals(task5.path, events[5].path) - self.assertEquals(task5.get_dependencies(), []) - self.assertEquals(other_task_, other_task) - - self.assertEquals(events[0].get_tasks(), [other_task]) + self.assertEqual(type(task5), Orderer) + self.assertEqual(task5.path, events[5].path) + self.assertEqual(task5.get_dependencies(), []) + self.assertEqual(other_task_, other_task) + + self.assertEqual(events[0].get_tasks(), [other_task]) other_task_, task1 = events[1].get_tasks() - self.assertEquals(type(task1), Orderer) - self.assertEquals(task1.path, events[1].path) - self.assertEquals(task1.get_dependencies(), [task5]) - self.assertEquals(other_task_, other_task) - - self.assertEquals(events[2].get_tasks(), [other_task]) + self.assertEqual(type(task1), Orderer) + self.assertEqual(task1.path, events[1].path) + self.assertEqual(task1.get_dependencies(), [task5]) + self.assertEqual(other_task_, other_task) + + self.assertEqual(events[2].get_tasks(), [other_task]) other_task_, task3 = events[3].get_tasks() - self.assertEquals(type(task3), Orderer) - self.assertEquals(task3.path, events[3].path) - self.assertEquals(task3.get_dependencies(), [task5]) - self.assertEquals(other_task_, other_task) + self.assertEqual(type(task3), Orderer) + self.assertEqual(task3.path, events[3].path) + self.assertEqual(task3.get_dependencies(), [task5]) + self.assertEqual(other_task_, other_task) def test_default_ordering(self): - self.assertEquals(self.mocker.is_ordering(), False) + self.assertEqual(self.mocker.is_ordering(), False) def test_order_without_arguments(self): self.mocker.order() - self.assertEquals(self.mocker.is_ordering(), True) + self.assertEqual(self.mocker.is_ordering(), True) def test_order_with_context_manager(self): with_manager = self.mocker.order() - self.assertEquals(self.mocker.is_ordering(), True) + self.assertEqual(self.mocker.is_ordering(), True) with_manager.__enter__() - self.assertEquals(self.mocker.is_ordering(), True) + self.assertEqual(self.mocker.is_ordering(), True) with_manager.__exit__(None, None, None) - self.assertEquals(self.mocker.is_ordering(), False) + self.assertEqual(self.mocker.is_ordering(), False) def test_unorder(self): self.mocker.order() self.mocker.unorder() - self.assertEquals(self.mocker.is_ordering(), False) + self.assertEqual(self.mocker.is_ordering(), False) def test_ordered_events(self): mock = self.mocker.mock() @@ -2080,17 +2080,17 @@ (task2,) = events[2].get_tasks() (task3,) = events[3].get_tasks() - self.assertEquals(type(task1), Orderer) - self.assertEquals(type(task2), Orderer) - self.assertEquals(type(task3), Orderer) - - self.assertEquals(task1.path, events[1].path) - self.assertEquals(task2.path, events[2].path) - self.assertEquals(task3.path, events[3].path) - - self.assertEquals(task1.get_dependencies(), []) - self.assertEquals(task2.get_dependencies(), [task1]) - self.assertEquals(task3.get_dependencies(), [task2]) + self.assertEqual(type(task1), Orderer) + self.assertEqual(type(task2), Orderer) + self.assertEqual(type(task3), Orderer) + + self.assertEqual(task1.path, events[1].path) + self.assertEqual(task2.path, events[2].path) + self.assertEqual(task3.path, events[3].path) + + self.assertEqual(task1.get_dependencies(), []) + self.assertEqual(task2.get_dependencies(), [task1]) + self.assertEqual(task3.get_dependencies(), [task2]) def test_nospec(self): event1 = self.mocker.add_event(Event()) @@ -2100,8 +2100,8 @@ task3 = event2.add_task(SpecChecker(None)) task4 = event2.add_task(Task()) self.mocker.nospec() - self.assertEquals(event1.get_tasks(), [task1]) - self.assertEquals(event2.get_tasks(), [task2, task4]) + self.assertEqual(event1.get_tasks(), [task1]) + self.assertEqual(event2.get_tasks(), [task2, task4]) def test_passthrough(self): obj = object() @@ -2109,9 +2109,9 @@ event1 = self.mocker.add_event(Event(Path(mock, obj))) event2 = self.mocker.add_event(Event(Path(mock, obj))) self.mocker.passthrough() - self.assertEquals(event1.get_tasks(), []) + self.assertEqual(event1.get_tasks(), []) (task,) = event2.get_tasks() - self.assertEquals(type(task), PathExecuter) + self.assertEqual(type(task), PathExecuter) def test_passthrough_fails_on_unproxied(self): mock = self.mocker.mock() @@ -2126,32 +2126,32 @@ result_callback = object() self.mocker.passthrough(result_callback) (task,) = event.get_tasks() - self.assertEquals(task.get_result_callback(), result_callback) + self.assertEqual(task.get_result_callback(), result_callback) def test_on(self): obj = self.mocker.mock() self.mocker.on(obj.attr).result(123) self.mocker.replay() - self.assertEquals(obj.attr, 123) + self.assertEqual(obj.attr, 123) def test_patch(self): class C(object): pass mock = self.mocker.patch(C) - self.assertEquals(type(C.__mocker_mock__), Mock) + self.assertEqual(type(C.__mocker_mock__), Mock) self.assertTrue(C.__mocker_mock__ is mock) self.assertTrue(mock.__mocker_object__ is C) - self.assertEquals(type(mock.__mocker_patcher__), Patcher) - self.assertEquals(mock.__mocker_passthrough__, True) - self.assertEquals(mock.__mocker_spec__, C) + self.assertEqual(type(mock.__mocker_patcher__), Patcher) + self.assertEqual(mock.__mocker_passthrough__, True) + self.assertEqual(mock.__mocker_spec__, C) (event,) = self.mocker.get_events() - self.assertEquals(type(event), ReplayRestoreEvent) + self.assertEqual(type(event), ReplayRestoreEvent) (task,) = event.get_tasks() self.assertTrue(task is mock.__mocker_patcher__) def test_patch_without_spec(self): class C(object): pass mock = self.mocker.patch(C, spec=None) - self.assertEquals(mock.__mocker_spec__, None) + self.assertEqual(mock.__mocker_spec__, None) def test_patch_and_restore_unsets_mocker_mock(self): class C(object): pass @@ -2170,15 +2170,15 @@ def test_create(self): objects = [object() for i in range(4)] action = Action(*objects) - self.assertEquals(action.kind, objects[0]) - self.assertEquals(action.args, objects[1]) - self.assertEquals(action.kwargs, objects[2]) - self.assertEquals(action.path, objects[3]) + self.assertEqual(action.kind, objects[0]) + self.assertEqual(action.args, objects[1]) + self.assertEqual(action.kwargs, objects[2]) + self.assertEqual(action.path, objects[3]) def test_repr(self): - self.assertEquals(repr(Action("kind", "args", "kwargs")), + self.assertEqual(repr(Action("kind", "args", "kwargs")), "Action('kind', 'args', 'kwargs')") - self.assertEquals(repr(Action("kind", "args", "kwargs", "path")), + self.assertEqual(repr(Action("kind", "args", "kwargs", "path")), "Action('kind', 'args', 'kwargs', 'path')") def test_execute_unknown(self): @@ -2190,7 +2190,7 @@ obj = C() obj.attr = C() action = Action("getattr", ("attr",), {}) - self.assertEquals(action.execute(obj), obj.attr) + self.assertEqual(action.execute(obj), obj.attr) def test_execute_setattr(self): class C(object): @@ -2198,7 +2198,7 @@ obj = C() action = Action("setattr", ("attr", "value"), {}) action.execute(obj) - self.assertEquals(getattr(obj, "attr", None), "value") + self.assertEqual(getattr(obj, "attr", None), "value") def test_execute_delattr(self): class C(object): @@ -2207,24 +2207,24 @@ obj.attr = "value" action = Action("delattr", ("attr",), {}) action.execute(obj) - self.assertEquals(getattr(obj, "attr", None), None) + self.assertEqual(getattr(obj, "attr", None), None) def test_execute_call(self): obj = lambda a, b: a+b action = Action("call", (1,), {"b": 2}) - self.assertEquals(action.execute(obj), 3) + self.assertEqual(action.execute(obj), 3) def test_execute_contains(self): obj = ["a"] action = Action("contains", ("a",), {}) - self.assertEquals(action.execute(obj), True) + self.assertEqual(action.execute(obj), True) action = Action("contains", ("b",), {}) - self.assertEquals(action.execute(obj), False) + self.assertEqual(action.execute(obj), False) def test_execute_getitem(self): obj = {"a": 1} action = Action("getitem", ("a",), {}) - self.assertEquals(action.execute(obj), 1) + self.assertEqual(action.execute(obj), 1) action = Action("getitem", ("b",), {}) self.assertRaises(KeyError, action.execute, obj) @@ -2232,58 +2232,58 @@ obj = {} action = Action("setitem", ("a", 1), {}) action.execute(obj) - self.assertEquals(obj, {"a": 1}) + self.assertEqual(obj, {"a": 1}) def test_execute_delitem(self): obj = {"a": 1, "b": 2} action = Action("delitem", ("a",), {}) action.execute(obj) - self.assertEquals(obj, {"b": 2}) + self.assertEqual(obj, {"b": 2}) def test_execute_len(self): obj = [1, 2, 3] action = Action("len", (), {}) - self.assertEquals(action.execute(obj), 3) + self.assertEqual(action.execute(obj), 3) def test_execute_nonzero(self): obj = [] action = Action("nonzero", (), {}) - self.assertEquals(action.execute(obj), False) + self.assertEqual(action.execute(obj), False) obj = [1] action = Action("nonzero", (), {}) - self.assertEquals(action.execute(obj), True) + self.assertEqual(action.execute(obj), True) def test_execute_iter(self): obj = [1, 2, 3] action = Action("iter", (), {}) result = action.execute(obj) - self.assertEquals(type(result), type(iter(obj))) - self.assertEquals(list(result), obj) + self.assertEqual(type(result), type(iter(obj))) + self.assertEqual(list(result), obj) def test_execute_caching(self): - values = iter(range(10)) - obj = lambda: values.next() + values = iter(list(range(10))) + obj = lambda: next(values) action = Action("call", (), {}) - self.assertEquals(action.execute(obj), 0) - self.assertEquals(action.execute(obj), 0) - obj = lambda: values.next() - self.assertEquals(action.execute(obj), 1) + self.assertEqual(action.execute(obj), 0) + self.assertEqual(action.execute(obj), 0) + obj = lambda: next(values) + self.assertEqual(action.execute(obj), 1) def test_equals(self): obj1 = object() obj2 = object() - self.assertEquals(Action("kind", (), {}, obj1), + self.assertEqual(Action("kind", (), {}, obj1), Action("kind", (), {}, obj2)) - self.assertNotEquals(Action("kind", (), {}, obj1), + self.assertNotEqual(Action("kind", (), {}, obj1), Action("dnik", (), {}, obj2)) - self.assertNotEquals(Action("kind", (), {}, obj1), + self.assertNotEqual(Action("kind", (), {}, obj1), Action("kind", (1,), {}, obj2)) - self.assertNotEquals(Action("kind", (), {}, obj1), + self.assertNotEqual(Action("kind", (), {}, obj1), Action("kind", (), {"a": 1}, obj2)) - self.assertNotEquals(Action("kind", (ANY,), {}, obj1), + self.assertNotEqual(Action("kind", (ANY,), {}, obj1), Action("kind", (1,), {}, obj2)) - self.assertEquals(Action("kind", (CONTAINS(1),), {}, obj1), + self.assertEqual(Action("kind", (CONTAINS(1),), {}, obj1), Action("kind", (CONTAINS(1),), {}, obj2)) def test_matches(self): @@ -2328,40 +2328,40 @@ def test_create(self): mock = object() path = Path(mock) - self.assertEquals(path.root_mock, mock) - self.assertEquals(path.root_object, None) - self.assertEquals(path.actions, ()) + self.assertEqual(path.root_mock, mock) + self.assertEqual(path.root_object, None) + self.assertEqual(path.actions, ()) def test_create_with_object(self): mock = object() path = Path(mock, self.object) - self.assertEquals(path.root_mock, mock) - self.assertEquals(path.root_object, self.object) + self.assertEqual(path.root_mock, mock) + self.assertEqual(path.root_object, self.object) def test_create_with_actions(self): mock = object() path = Path(mock, self.object, [1,2,3]) - self.assertEquals(path.root_mock, mock) - self.assertEquals(path.root_object, self.object) - self.assertEquals(path.actions, (1,2,3)) + self.assertEqual(path.root_mock, mock) + self.assertEqual(path.root_object, self.object) + self.assertEqual(path.actions, (1,2,3)) def test_add(self): mock = object() path = Path(mock, self.object, [1,2,3]) result = path + 4 self.assertTrue(result is not path) - self.assertEquals(result.root_mock, mock) - self.assertEquals(result.root_object, self.object) - self.assertEquals(result.actions, (1,2,3,4)) + self.assertEqual(result.root_mock, mock) + self.assertEqual(result.root_object, self.object) + self.assertEqual(result.actions, (1,2,3,4)) def test_parent_path(self): path1 = Path(self.mock) path2 = path1 + Action("getattr", ("attr",), {}, path1) path3 = path2 + Action("getattr", ("attr",), {}, path2) - self.assertEquals(path1.parent_path, None) - self.assertEquals(path2.parent_path, path1) - self.assertEquals(path3.parent_path, path2) + self.assertEqual(path1.parent_path, None) + self.assertEqual(path2.parent_path, path1) + self.assertEqual(path3.parent_path, path2) def test_equals(self): mock = object() @@ -2372,44 +2372,44 @@ # Not the *same* mock. path1 = Path([], obj, []) path2 = Path([], obj, []) - self.assertNotEquals(path1, path2) + self.assertNotEqual(path1, path2) # Not the *same* object. path1 = Path(mock, [], []) path2 = Path(mock, [], []) - self.assertNotEquals(path1, path2) + self.assertNotEqual(path1, path2) path1 = Path(mock, obj, [Action("kind", (), {}, obj1)]) path2 = Path(mock, obj, [Action("kind", (), {}, obj2)]) - self.assertEquals(path1, path2) + self.assertEqual(path1, path2) path1 = Path(mock, obj, [Action("kind", (), {}, obj1)]) path2 = Path(mock, obj, [Action("dnik", (), {}, obj2)]) - self.assertNotEquals(path1, path2) + self.assertNotEqual(path1, path2) path1 = Path(mock, obj, [Action("kind", (), {}, obj1)]) path2 = Path(object(), obj, [Action("kind", (), {}, obj2)]) - self.assertNotEquals(path1, path2) + self.assertNotEqual(path1, path2) path1 = Path(mock, obj, [Action("kind", (), {}, obj1)]) path2 = Path(mock, obj, [Action("kind", (1,), {}, obj2)]) - self.assertNotEquals(path1, path2) + self.assertNotEqual(path1, path2) path1 = Path(mock, obj, [Action("kind", (), {}, obj1)]) path2 = Path(mock, obj, [Action("kind", (), {"a": 1}, obj2)]) - self.assertNotEquals(path1, path2) + self.assertNotEqual(path1, path2) path1 = Path(mock, obj, [Action("kind", (), {}, obj1)]) path2 = Path(mock, obj, []) - self.assertNotEquals(path1, path2) + self.assertNotEqual(path1, path2) path1 = Path(mock, obj, [Action("kind", (ANY,), {}, obj1)]) path2 = Path(mock, obj, [Action("kind", (1,), {}, obj2)]) - self.assertNotEquals(path1, path2) + self.assertNotEqual(path1, path2) path1 = Path(mock, obj, [Action("kind", (CONTAINS(1),), {}, obj1)]) path2 = Path(mock, obj, [Action("kind", (CONTAINS(1),), {}, obj2)]) - self.assertEquals(path1, path2) + self.assertEqual(path1, path2) def test_matches(self): obj = object() @@ -2460,76 +2460,76 @@ def test_str(self): path = Path(self.mock, []) - self.assertEquals(str(path), "obj") + self.assertEqual(str(path), "obj") def test_str_unnamed(self): mock = Mock(self.mocker) path = Path(mock, []) - self.assertEquals(str(path), "") + self.assertEqual(str(path), "") def test_str_auto_named(self): named_mock = Mock(self.mocker) named_mock.attr path = Path(named_mock, []) - self.assertEquals(str(path), "named_mock") + self.assertEqual(str(path), "named_mock") def test_str_getattr(self): path = Path(self.mock, None, [Action("getattr", ("attr",), {})]) - self.assertEquals(str(path), "obj.attr") + self.assertEqual(str(path), "obj.attr") path += Action("getattr", ("x",), {}) - self.assertEquals(str(path), "obj.attr.x") + self.assertEqual(str(path), "obj.attr.x") def test_str_getattr_call(self): path = Path(self.mock, None, [Action("getattr", ("x",), {}), Action("getattr", ("y",), {}), Action("call", ("z",), {})]) - self.assertEquals(str(path), "obj.x.y('z')") + self.assertEqual(str(path), "obj.x.y('z')") def test_str_setattr(self): path = Path(self.mock, None, [Action("setattr", ("attr", "value"), {})]) - self.assertEquals(str(path), "obj.attr = 'value'") + self.assertEqual(str(path), "obj.attr = 'value'") def test_str_delattr(self): path = Path(self.mock, None, [Action("delattr", ("attr",), {})]) - self.assertEquals(str(path), "del obj.attr") + self.assertEqual(str(path), "del obj.attr") def test_str_call(self): path = Path(self.mock, None, [Action("call", (), {})]) - self.assertEquals(str(path), "obj()") + self.assertEqual(str(path), "obj()") path = Path(self.mock, None, [Action("call", (1, "2"), {"a": 3, "b": "4"})]) - self.assertEquals(str(path), "obj(1, '2', a=3, b='4')") + self.assertEqual(str(path), "obj(1, '2', a=3, b='4')") def test_str_contains(self): path = Path(self.mock, None, [Action("contains", ("value",), {})]) - self.assertEquals(str(path), "'value' in obj") + self.assertEqual(str(path), "'value' in obj") def test_str_getitem(self): path = Path(self.mock, None, [Action("getitem", ("key",), {})]) - self.assertEquals(str(path), "obj['key']") + self.assertEqual(str(path), "obj['key']") def test_str_setitem(self): path = Path(self.mock, None, [Action("setitem", ("key", "value"), {})]) - self.assertEquals(str(path), "obj['key'] = 'value'") + self.assertEqual(str(path), "obj['key'] = 'value'") def test_str_delitem(self): path = Path(self.mock, None, [Action("delitem", ("key",), {})]) - self.assertEquals(str(path), "del obj['key']") + self.assertEqual(str(path), "del obj['key']") def test_str_len(self): path = Path(self.mock, None, [Action("len", (), {})]) - self.assertEquals(str(path), "len(obj)") + self.assertEqual(str(path), "len(obj)") def test_str_nonzero(self): path = Path(self.mock, None, [Action("nonzero", (), {})]) - self.assertEquals(str(path), "bool(obj)") + self.assertEqual(str(path), "bool(obj)") def test_str_iter(self): path = Path(self.mock, None, [Action("iter", (), {})]) - self.assertEquals(str(path), "iter(obj)") + self.assertEqual(str(path), "iter(obj)") def test_str_raises_on_unknown(self): path = Path(self.mock, None, [Action("unknown", (), {})]) @@ -2544,7 +2544,7 @@ path = Path(self.mock, None, [Action("getattr", ("x",), {}), Action("getattr", ("y",), {}), Action("call", (1,), {"b": 2})]) - self.assertEquals(path.execute(obj), 3) + self.assertEqual(path.execute(obj), 3) class MatchParamsTest(TestCase): @@ -2556,12 +2556,12 @@ self.assertFalse(match_params(*args), repr(args)) def test_any_repr(self): - self.assertEquals(repr(ANY), "ANY") + self.assertEqual(repr(ANY), "ANY") def test_any_equals(self): - self.assertEquals(ANY, ANY) - self.assertNotEquals(ANY, ARGS) - self.assertNotEquals(ANY, object()) + self.assertEqual(ANY, ANY) + self.assertNotEqual(ANY, ARGS) + self.assertNotEqual(ANY, object()) def test_any_matches(self): self.assertTrue(ANY.matches(1)) @@ -2569,14 +2569,14 @@ self.assertTrue(ANY.matches(object())) def test_is_repr(self): - self.assertEquals(repr(IS("obj")), "IS('obj')") + self.assertEqual(repr(IS("obj")), "IS('obj')") def test_is_equals(self): l1 = [] l2 = [] - self.assertNotEquals(IS(l1), l2) - self.assertEquals(IS(l1), IS(l1)) - self.assertNotEquals(IS(l1), IS(l2)) + self.assertNotEqual(IS(l1), l2) + self.assertEqual(IS(l1), IS(l1)) + self.assertNotEqual(IS(l1), IS(l2)) def test_is_matches(self): l1 = [] @@ -2586,11 +2586,11 @@ self.assertFalse(IS(l1).matches(ANY)) def test_contains_repr(self): - self.assertEquals(repr(CONTAINS("obj")), "CONTAINS('obj')") + self.assertEqual(repr(CONTAINS("obj")), "CONTAINS('obj')") def test_contains_equals(self): - self.assertEquals(CONTAINS([1]), CONTAINS([1])) - self.assertNotEquals(CONTAINS(1), CONTAINS([1])) + self.assertEqual(CONTAINS([1]), CONTAINS([1])) + self.assertNotEqual(CONTAINS(1), CONTAINS([1])) def test_contains_matches(self): self.assertTrue(CONTAINS(1).matches([1])) @@ -2605,11 +2605,11 @@ self.assertTrue(CONTAINS(1).matches(C())) def test_in_repr(self): - self.assertEquals(repr(IN("obj")), "IN('obj')") + self.assertEqual(repr(IN("obj")), "IN('obj')") def test_in_equals(self): - self.assertEquals(IN([1]), IN([1])) - self.assertNotEquals(IN([1]), IN(1)) + self.assertEqual(IN([1]), IN([1])) + self.assertNotEqual(IN([1]), IN(1)) def test_in_matches(self): self.assertTrue(IN([1]).matches(1)) @@ -2617,12 +2617,12 @@ self.assertFalse(IN([1]).matches(object())) def test_match_repr(self): - self.assertEquals(repr(MATCH("obj")), "MATCH('obj')") + self.assertEqual(repr(MATCH("obj")), "MATCH('obj')") def test_match_equals(self): obj1, obj2 = [], [] - self.assertEquals(MATCH(obj1), MATCH(obj1)) - self.assertNotEquals(MATCH(obj1), MATCH(obj2)) + self.assertEqual(MATCH(obj1), MATCH(obj1)) + self.assertNotEqual(MATCH(obj1), MATCH(obj2)) def test_match_matches(self): self.assertTrue(MATCH(lambda x: x > 10).matches(15)) @@ -2746,55 +2746,55 @@ self.mock = Mock(self.mocker) def test_default_attributes(self): - self.assertEquals(self.mock.__mocker__, self.mocker) - self.assertEquals(self.mock.__mocker_path__, Path(self.mock)) - self.assertEquals(self.mock.__mocker_name__, None) - self.assertEquals(self.mock.__mocker_spec__, None) - self.assertEquals(self.mock.__mocker_type__, None) - self.assertEquals(self.mock.__mocker_object__, None) - self.assertEquals(self.mock.__mocker_passthrough__, False) - self.assertEquals(self.mock.__mocker_patcher__, None) - self.assertEquals(self.mock.__mocker_replace__, False) - self.assertEquals(self.mock.__mocker_count__, True) + self.assertEqual(self.mock.__mocker__, self.mocker) + self.assertEqual(self.mock.__mocker_path__, Path(self.mock)) + self.assertEqual(self.mock.__mocker_name__, None) + self.assertEqual(self.mock.__mocker_spec__, None) + self.assertEqual(self.mock.__mocker_type__, None) + self.assertEqual(self.mock.__mocker_object__, None) + self.assertEqual(self.mock.__mocker_passthrough__, False) + self.assertEqual(self.mock.__mocker_patcher__, None) + self.assertEqual(self.mock.__mocker_replace__, False) + self.assertEqual(self.mock.__mocker_count__, True) def test_path(self): path = object() - self.assertEquals(Mock(self.mocker, path).__mocker_path__, path) + self.assertEqual(Mock(self.mocker, path).__mocker_path__, path) def test_object(self): mock = Mock(self.mocker, object="foo") - self.assertEquals(mock.__mocker_object__, "foo") - self.assertEquals(mock.__mocker_path__.root_object, "foo") + self.assertEqual(mock.__mocker_object__, "foo") + self.assertEqual(mock.__mocker_path__.root_object, "foo") def test_passthrough(self): mock = Mock(self.mocker, object="foo", passthrough=True) - self.assertEquals(mock.__mocker_object__, "foo") - self.assertEquals(mock.__mocker_passthrough__, True) + self.assertEqual(mock.__mocker_object__, "foo") + self.assertEqual(mock.__mocker_passthrough__, True) def test_spec(self): C = object() - self.assertEquals(Mock(self.mocker, spec=C).__mocker_spec__, C) + self.assertEqual(Mock(self.mocker, spec=C).__mocker_spec__, C) def test_class_without_type(self): mock = Mock(self.mocker) - self.assertEquals(mock.__class__, Mock) + self.assertEqual(mock.__class__, Mock) self.mocker.replay() - self.assertEquals(mock.__class__, Mock) + self.assertEqual(mock.__class__, Mock) def test_class_with_type_when_recording(self): class C(object): pass mock = Mock(self.mocker, type=C) - self.assertEquals(mock.__mocker_type__, C) - self.assertEquals(mock.__class__, Mock) - self.assertEquals(isinstance(mock, Mock), True) + self.assertEqual(mock.__mocker_type__, C) + self.assertEqual(mock.__class__, Mock) + self.assertEqual(isinstance(mock, Mock), True) def test_class_with_type_when_replaying(self): class C(object): pass mock = Mock(self.mocker, type=C) self.mocker.replay() - self.assertEquals(mock.__mocker_type__, C) - self.assertEquals(mock.__class__, C) - self.assertEquals(isinstance(mock, C), True) + self.assertEqual(mock.__mocker_type__, C) + self.assertEqual(mock.__class__, C) + self.assertEqual(isinstance(mock, C), True) def test_auto_naming(self): named_mock = self.mock @@ -2802,20 +2802,20 @@ another_name = named_mock named_mock = None # Can't find this one anymore. another_name.attr - self.assertEquals(another_name.__mocker_name__, "named_mock") + self.assertEqual(another_name.__mocker_name__, "named_mock") def test_auto_naming_on_self(self): self.named_mock = self.mock del self.mock self.named_mock.attr - self.assertEquals(self.named_mock.__mocker_name__, "named_mock") + self.assertEqual(self.named_mock.__mocker_name__, "named_mock") def test_auto_naming_on_bad_self(self): self_ = self self = object() # No __dict__ self_.named_mock = self_.mock self_.named_mock.attr - self_.assertEquals(self_.named_mock.__mocker_name__, None) + self_.assertEqual(self_.named_mock.__mocker_name__, None) def test_auto_naming_without_getframe(self): getframe = sys._getframe @@ -2823,85 +2823,85 @@ try: self.named_mock = self.mock self.named_mock.attr - self.assertEquals(self.named_mock.__mocker_name__, None) + self.assertEqual(self.named_mock.__mocker_name__, None) finally: sys._getframe = getframe def test_getattr(self): - self.assertEquals(self.mock.attr, 42) + self.assertEqual(self.mock.attr, 42) (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("getattr", ("attr",), {})) def test_setattr(self): self.mock.attr = 24 (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("setattr", ("attr", 24), {})) def test_delattr(self): del self.mock.attr (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("delattr", ("attr",), {})) def test_call(self): self.mock(1, a=2) (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("call", (1,), {"a": 2})) def test_contains(self): - self.assertEquals("value" in self.mock, True) # True due to 42. + self.assertEqual("value" in self.mock, True) # True due to 42. (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("contains", ("value",), {})) def test_getitem(self): - self.assertEquals(self.mock["key"], 42) + self.assertEqual(self.mock["key"], 42) (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("getitem", ("key",), {})) def test_setitem(self): self.mock["key"] = "value" (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("setitem", ("key", "value"), {})) def test_delitem(self): del self.mock["key"] (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("delitem", ("key",), {})) def test_len(self): - self.assertEquals(len(self.mock), 42) + self.assertEqual(len(self.mock), 42) (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("len", (), {})) def test_len_with_mock_result(self): self.mocker.act = lambda path: Mock(self.mocker) - self.assertEquals(len(self.mock), 0) + self.assertEqual(len(self.mock), 0) def test_len_transforms_match_error_to_attribute_error(self): """ @@ -2914,8 +2914,8 @@ self.mocker.act = raise_error try: len(self.mock) - except AttributeError, e: - self.assertEquals(str(e), "Kaboom!") + except AttributeError as e: + self.assertEqual(str(e), "Kaboom!") except MatchError: self.fail("Expected AttributeError, not MatchError.") else: @@ -2933,19 +2933,19 @@ self.mocker.act = raise_error try: self.mock.__length_hint__ - except AttributeError, e: - self.assertEquals(str(e), "No __length_hint__ here!") + except AttributeError as e: + self.assertEqual(str(e), "No __length_hint__ here!") except MatchError: self.fail("Expected AttributeError, not MatchError.") else: self.fail("AttributeError not raised.") def test_nonzero(self): - self.assertEquals(bool(self.mock), True) # True due to 42. + self.assertEqual(bool(self.mock), True) # True due to 42. (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("nonzero", (), {})) def test_nonzero_returns_true_on_match_error(self): @@ -2957,22 +2957,22 @@ def raise_error(path): raise MatchError("Kaboom!") self.mocker.act = raise_error - self.assertEquals(bool(self.mock), True) + self.assertEqual(bool(self.mock), True) def test_nonzero_with_mock_result(self): self.mocker.act = lambda path: Mock(self.mocker) - self.assertEquals(bool(self.mock), True) + self.assertEqual(bool(self.mock), True) def test_iter(self): result_mock = Mock(self.mocker) self.mocker.act = lambda path: self.paths.append(path) or result_mock result = iter(self.mock) - self.assertEquals(type(result), type(iter([]))) - self.assertEquals(list(result), []) + self.assertEqual(type(result), type(iter([]))) + self.assertEqual(list(result), []) (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) - self.assertEquals(path, self.mock.__mocker_path__ + + self.assertEqual(path, self.mock.__mocker_path__ + Action("iter", (), {})) def test_passthrough_on_unexpected(self): @@ -2987,26 +2987,26 @@ mock = Mock(StubMocker(), object=C()) self.assertRaises(MatchError, getattr, mock, "x", 42) - self.assertEquals(mock.y, 42) + self.assertEqual(mock.y, 42) mock = Mock(StubMocker(), passthrough=True) self.assertRaises(MatchError, getattr, mock, "x", 42) - self.assertEquals(mock.y, 42) + self.assertEqual(mock.y, 42) mock = Mock(StubMocker(), object=C(), passthrough=True) - self.assertEquals(mock.x, 123) - self.assertEquals(mock.y, 42) + self.assertEqual(mock.x, 123) + self.assertEqual(mock.y, 42) mock = Mock(StubMocker(), passthrough=True) act = mock.__mocker_act__ - self.assertEquals(act("getattr", ("x",), 42, object=C()), 123) - self.assertEquals(act("getattr", ("y",), 42, object=C()), 42) + self.assertEqual(act("getattr", ("x",), 42, object=C()), 123) + self.assertEqual(act("getattr", ("y",), 42, object=C()), 42) def test_act_with_object(self): obj = object() self.mock.__mocker_act__("kind", object=obj) (path,) = self.paths - self.assertEquals(type(path), Path) + self.assertEqual(type(path), Path) self.assertTrue(path.parent_path is self.mock.__mocker_path__) self.assertTrue(path.root_object is obj) @@ -3018,14 +3018,14 @@ mock = Mock(StubMocker()) try: mock.__mocker_act__("kind") - except AssertionError, e: + except AssertionError as e: message = os.linesep.join(["[Mocker] Unmet expectation:", "", "=> An", " - error", " - happened", ""]) - self.assertEquals(str(e), message) + self.assertEqual(str(e), message) else: self.fail("AssertionError not raised") @@ -3033,10 +3033,10 @@ """Check for kind support on Action.execute() and Path.__str__().""" mocker = Mocker() check = [] - for name, attr in Mock.__dict__.iteritems(): + for name, attr in Mock.__dict__.items(): if not name.startswith("__mocker_") and hasattr(attr, "__call__"): mock = mocker.mock() - args = ["arg"] * (attr.func_code.co_argcount - 1) + args = ["arg"] * (attr.__code__.co_argcount - 1) try: attr(mock, *args) except: @@ -3067,33 +3067,33 @@ self.event = Event() def test_default_path(self): - self.assertEquals(self.event.path, None) + self.assertEqual(self.event.path, None) def test_path(self): path = object() event = Event(path) - self.assertEquals(event.path, path) + self.assertEqual(event.path, path) def test_add_and_get_tasks(self): task1 = Task() task2 = Task() self.assertEqual(self.event.add_task(task1), task1) self.assertEqual(self.event.add_task(task2), task2) - self.assertEquals(self.event.get_tasks(), [task1, task2]) + self.assertEqual(self.event.get_tasks(), [task1, task2]) def test_prepend_tasks(self): task1 = Task() task2 = Task() self.assertEqual(self.event.prepend_task(task1), task1) self.assertEqual(self.event.prepend_task(task2), task2) - self.assertEquals(self.event.get_tasks(), [task2, task1]) + self.assertEqual(self.event.get_tasks(), [task2, task1]) def test_remove_task(self): task1 = self.event.add_task(Task()) task2 = self.event.add_task(Task()) task3 = self.event.add_task(Task()) self.event.remove_task(task2) - self.assertEquals(self.event.get_tasks(), [task1, task3]) + self.assertEqual(self.event.get_tasks(), [task1, task3]) def test_replace_task(self): task1 = self.event.add_task(Task()) @@ -3101,26 +3101,26 @@ task3 = self.event.add_task(Task()) task4 = Task() task5 = self.event.replace_task(task2, task4) - self.assertEquals(self.event.get_tasks(), [task1, task4, task3]) + self.assertEqual(self.event.get_tasks(), [task1, task4, task3]) self.assertTrue(task4 is task5) def test_default_matches(self): - self.assertEquals(self.event.matches(None), False) + self.assertEqual(self.event.matches(None), False) def test_default_run(self): - self.assertEquals(self.event.run(None), None) + self.assertEqual(self.event.run(None), None) def test_default_satisfied(self): - self.assertEquals(self.event.satisfied(), True) + self.assertEqual(self.event.satisfied(), True) def test_default_verify(self): - self.assertEquals(self.event.verify(), None) + self.assertEqual(self.event.verify(), None) def test_default_replay(self): - self.assertEquals(self.event.replay(), None) + self.assertEqual(self.event.replay(), None) def test_default_restore(self): - self.assertEquals(self.event.restore(), None) + self.assertEqual(self.event.restore(), None) def test_matches_false(self): task1 = self.event.add_task(Task()) @@ -3129,21 +3129,21 @@ task2.matches = lambda path: False task3 = self.event.add_task(Task()) task3.matches = lambda path: True - self.assertEquals(self.event.matches(None), False) + self.assertEqual(self.event.matches(None), False) def test_matches_true(self): task1 = self.event.add_task(Task()) task1.matches = lambda path: True task2 = self.event.add_task(Task()) task2.matches = lambda path: True - self.assertEquals(self.event.matches(None), True) + self.assertEqual(self.event.matches(None), True) def test_matches_argument(self): calls = [] task = self.event.add_task(Task()) task.matches = lambda path: calls.append(path) self.event.matches(42) - self.assertEquals(calls, [42]) + self.assertEqual(calls, [42]) def test_run(self): calls = [] @@ -3153,8 +3153,8 @@ task2.run = lambda path: calls.append(path) or False task3 = self.event.add_task(Task()) task3.run = lambda path: calls.append(path) or None - self.assertEquals(self.event.run(42), False) - self.assertEquals(calls, [42, 42, 42]) + self.assertEqual(self.event.run(42), False) + self.assertEqual(calls, [42, 42, 42]) def test_run_errors(self): class MyTask(Task): @@ -3171,11 +3171,11 @@ try: event.run("i.am.a.path") - except AssertionError, e: + except AssertionError as e: message = os.linesep.join(["i.am.a.path", "- 1 failed", "- 3 failed"]) - self.assertEquals(str(e), message) + self.assertEqual(str(e), message) else: self.fail("AssertionError not raised") @@ -3195,12 +3195,12 @@ try: event.run(42) - except AssertionError, e: + except AssertionError as e: message = os.linesep.join(["i.am.a.path", "- Run: 42", # <== "- 1 failed", "- 3 failed"]) - self.assertEquals(str(e), message) + self.assertEqual(str(e), message) else: self.fail("AssertionError not raised") @@ -3231,11 +3231,11 @@ try: event.run("i.am.a.path") - except AssertionError, e: + except AssertionError as e: message = os.linesep.join(["i.am.a.path", "- 1 failed", "- 3 failed"]) - self.assertEquals(str(e), message) + self.assertEqual(str(e), message) else: self.fail("AssertionError not raised") @@ -3256,17 +3256,17 @@ task2 = Task() task2.may_run = lambda path: calls.append((2, path)) - self.assertEquals(self.event.may_run(42), True) + self.assertEqual(self.event.may_run(42), True) self.event.add_task(task1) - self.assertEquals(self.event.may_run(42), True) - self.assertEquals(calls, [(1, 42)]) + self.assertEqual(self.event.may_run(42), True) + self.assertEqual(calls, [(1, 42)]) del calls[:] self.event.add_task(task2) self.event.add_task(task1) # Should return on first false. - self.assertEquals(self.event.may_run(42), False) - self.assertEquals(calls, [(1, 42), (2, 42)]) + self.assertEqual(self.event.may_run(42), False) + self.assertEqual(calls, [(1, 42), (2, 42)]) def test_satisfied_false(self): def raise_error(): @@ -3275,14 +3275,14 @@ task2 = self.event.add_task(Task()) task2.verify = raise_error task3 = self.event.add_task(Task()) - self.assertEquals(self.event.satisfied(), False) + self.assertEqual(self.event.satisfied(), False) def test_satisfied_true(self): task1 = self.event.add_task(Task()) task1.satisfied = lambda: True task2 = self.event.add_task(Task()) task2.satisfied = lambda: True - self.assertEquals(self.event.satisfied(), True) + self.assertEqual(self.event.satisfied(), True) def test_verify(self): class MyTask(object): @@ -3299,11 +3299,11 @@ try: event.verify() - except AssertionError, e: + except AssertionError as e: message = os.linesep.join(["i.am.a.path", "- 1 failed", "- 3 failed"]) - self.assertEquals(str(e), message) + self.assertEqual(str(e), message) else: self.fail("AssertionError not raised") @@ -3321,7 +3321,7 @@ task1.replay = lambda: calls.append("task1") task2.replay = lambda: calls.append("task2") self.event.replay() - self.assertEquals(calls, ["task1", "task2"]) + self.assertEqual(calls, ["task1", "task2"]) def test_restore(self): calls = [] @@ -3330,7 +3330,7 @@ task1.restore = lambda: calls.append("task1") task2.restore = lambda: calls.append("task2") self.event.restore() - self.assertEquals(calls, ["task1", "task2"]) + self.assertEqual(calls, ["task1", "task2"]) class ReplayRestoreEventTest(TestCase): @@ -3339,9 +3339,9 @@ self.event = ReplayRestoreEvent() def test_never_matches(self): - self.assertEquals(self.event.matches(None), False) + self.assertEqual(self.event.matches(None), False) self.event.add_task(Task()) - self.assertEquals(self.event.matches(None), False) + self.assertEqual(self.event.matches(None), False) class TaskTest(TestCase): @@ -3350,25 +3350,25 @@ self.task = Task() def test_default_matches(self): - self.assertEquals(self.task.matches(None), True) + self.assertEqual(self.task.matches(None), True) def test_default_may_run(self): - self.assertEquals(self.task.may_run(None), True) + self.assertEqual(self.task.may_run(None), True) def test_default_may_run_user_code(self): - self.assertEquals(self.task.may_run_user_code(), False) + self.assertEqual(self.task.may_run_user_code(), False) def test_default_run(self): - self.assertEquals(self.task.run(None), None) + self.assertEqual(self.task.run(None), None) def test_default_verify(self): - self.assertEquals(self.task.verify(), None) + self.assertEqual(self.task.verify(), None) def test_default_replay(self): - self.assertEquals(self.task.replay(), None) + self.assertEqual(self.task.replay(), None) def test_default_restore(self): - self.assertEquals(self.task.restore(), None) + self.assertEqual(self.task.restore(), None) class OnRestoreCallerTest(TestCase): @@ -3383,11 +3383,11 @@ def test_restore(self): calls = [] task = OnRestoreCaller(lambda: calls.append("callback")) - self.assertEquals(calls, []) + self.assertEqual(calls, []) task.restore() - self.assertEquals(calls, ["callback"]) + self.assertEqual(calls, ["callback"]) task.restore() - self.assertEquals(calls, ["callback", "callback"]) + self.assertEqual(calls, ["callback", "callback"]) class PathMatcherTest(TestCase): @@ -3402,7 +3402,7 @@ def test_create(self): path = object() task = PathMatcher(path) - self.assertEquals(task.path, path) + self.assertEqual(task.path, path) def test_matches(self): path = Path(self.mock, None, [Action("getattr", ("attr1",), {})]) @@ -3417,7 +3417,7 @@ event = Event(path) path_matcher_recorder(self.mocker, event) (task,) = event.get_tasks() - self.assertEquals(type(task), PathMatcher) + self.assertEqual(type(task), PathMatcher) self.assertTrue(task.path is path) def test_is_standard_recorder(self): @@ -3438,18 +3438,18 @@ def test_create_one_argument(self): task = RunCounter(2) - self.assertEquals(task.min, 2) - self.assertEquals(task.max, 2) + self.assertEqual(task.min, 2) + self.assertEqual(task.max, 2) def test_create_min_max(self): task = RunCounter(2, 3) - self.assertEquals(task.min, 2) - self.assertEquals(task.max, 3) + self.assertEqual(task.min, 2) + self.assertEqual(task.max, 3) def test_create_unbounded(self): task = RunCounter(2, None) - self.assertEquals(task.min, 2) - self.assertEquals(task.max, sys.maxint) + self.assertEqual(task.min, 2) + self.assertEqual(task.max, sys.maxsize) def test_run_one_argument(self): task = RunCounter(2) @@ -3465,9 +3465,9 @@ def test_may_run(self): task = RunCounter(1) - self.assertEquals(task.may_run(None), True) + self.assertEqual(task.may_run(None), True) task.run(self.path) - self.assertEquals(task.may_run(None), False) + self.assertEqual(task.may_run(None), False) def test_verify(self): task = RunCounter(2) @@ -3512,15 +3512,15 @@ self.event.add_task(MyTask()) run_counter_recorder(self.mocker, self.event) (task1, task2) = self.event.get_tasks() - self.assertEquals(type(task1), ImplicitRunCounter) - self.assertEquals(type(task2), MyTask) + self.assertEqual(type(task1), ImplicitRunCounter) + self.assertEqual(type(task2), MyTask) self.assertTrue(task1.min == 1) self.assertTrue(task1.max == 1) def test_recorder_wont_record_when_count_is_false(self): self.mock.__mocker_count__ = False run_counter_recorder(self.mocker, self.event) - self.assertEquals(self.event.get_tasks(), []) + self.assertEqual(self.event.get_tasks(), []) def test_removal_recorder(self): """ @@ -3555,23 +3555,23 @@ run_counter_removal_recorder(self.mocker, event5) - self.assertEquals(len(event2.get_tasks()), 3) - self.assertEquals(len(event3.get_tasks()), 3) - self.assertEquals(len(event4.get_tasks()), 3) - self.assertEquals(len(event5.get_tasks()), 3) + self.assertEqual(len(event2.get_tasks()), 3) + self.assertEqual(len(event3.get_tasks()), 3) + self.assertEqual(len(event4.get_tasks()), 3) + self.assertEqual(len(event5.get_tasks()), 3) # Now, for real. run_counter_removal_recorder(self.mocker, event4) - self.assertEquals(len(event2.get_tasks()), 3) - self.assertEquals(len(event3.get_tasks()), 2) - self.assertEquals(len(event4.get_tasks()), 3) - self.assertEquals(len(event5.get_tasks()), 3) + self.assertEqual(len(event2.get_tasks()), 3) + self.assertEqual(len(event3.get_tasks()), 2) + self.assertEqual(len(event4.get_tasks()), 3) + self.assertEqual(len(event5.get_tasks()), 3) task1, task2 = event3.get_tasks() - self.assertEquals(type(task1), RunCounter) - self.assertEquals(type(task2), RunCounter) + self.assertEqual(type(task1), RunCounter) + self.assertEqual(type(task2), RunCounter) def test_removal_recorder_with_obj(self): @@ -3583,11 +3583,11 @@ obj.x.y()() events = self.mocker.get_events() - self.assertEquals(len(events), 4) - self.assertEquals(len(events[0].get_tasks()), 0) - self.assertEquals(len(events[1].get_tasks()), 0) - self.assertEquals(len(events[2].get_tasks()), 1) - self.assertEquals(len(events[3].get_tasks()), 1) + self.assertEqual(len(events), 4) + self.assertEqual(len(events[0].get_tasks()), 0) + self.assertEqual(len(events[1].get_tasks()), 0) + self.assertEqual(len(events[2].get_tasks()), 1) + self.assertEqual(len(events[3].get_tasks()), 1) def test_reset_on_replay_with_mock(self): mock = self.mocker.mock() @@ -3621,7 +3621,7 @@ task = MockReturner(self.mocker) mock = task.run(self.path) self.assertTrue(isinstance(mock, Mock)) - self.assertEquals(mock.__mocker__, self.mocker) + self.assertEqual(mock.__mocker__, self.mocker) self.assertTrue(mock.__mocker_path__.matches(self.path)) def test_recorder(self): @@ -3634,29 +3634,29 @@ event3 = self.mocker.add_event(Event(path3)) event4 = self.mocker.add_event(Event(path4)) - self.assertEquals(len(event2.get_tasks()), 0) - self.assertEquals(len(event3.get_tasks()), 0) - self.assertEquals(len(event4.get_tasks()), 0) + self.assertEqual(len(event2.get_tasks()), 0) + self.assertEqual(len(event3.get_tasks()), 0) + self.assertEqual(len(event4.get_tasks()), 0) # Calling on 4 should add it only to the parent. mock_returner_recorder(self.mocker, event4) - self.assertEquals(len(event2.get_tasks()), 0) - self.assertEquals(len(event3.get_tasks()), 1) - self.assertEquals(len(event4.get_tasks()), 0) + self.assertEqual(len(event2.get_tasks()), 0) + self.assertEqual(len(event3.get_tasks()), 1) + self.assertEqual(len(event4.get_tasks()), 0) (task,) = event3.get_tasks() - self.assertEquals(type(task), MockReturner) - self.assertEquals(task.mocker, self.mocker) + self.assertEqual(type(task), MockReturner) + self.assertEqual(task.mocker, self.mocker) # Calling on it again shouldn't do anything. mock_returner_recorder(self.mocker, event4) - self.assertEquals(len(event2.get_tasks()), 0) - self.assertEquals(len(event3.get_tasks()), 1) - self.assertEquals(len(event4.get_tasks()), 0) + self.assertEqual(len(event2.get_tasks()), 0) + self.assertEqual(len(event3.get_tasks()), 1) + self.assertEqual(len(event4.get_tasks()), 0) def test_is_standard_recorder(self): self.assertTrue(mock_returner_recorder in Mocker.get_recorders()) @@ -3676,19 +3676,19 @@ def test_may_run_user_code(self): task = FunctionRunner(None) - self.assertEquals(task.may_run_user_code(), True) + self.assertEqual(task.may_run_user_code(), True) def test_run(self): task = FunctionRunner(lambda *args, **kwargs: repr((args, kwargs))) result = task.run(self.path) - self.assertEquals(result, "((1, 2), {'c': 3})") + self.assertEqual(result, "((1, 2), {'c': 3})") def test_run_with_object(self): task = FunctionRunner(lambda *args, **kwargs: repr((args, kwargs)), with_root_object=True) self.path.root_object = 4 result = task.run(self.path) - self.assertEquals(result, "((4, 1, 2), {'c': 3})") + self.assertEqual(result, "((4, 1, 2), {'c': 3})") class PathExecuterTest(TestCase): @@ -3711,7 +3711,7 @@ Action("call", (1,), {"b": 2})]) task = PathExecuter() - self.assertEquals(task.run(path), 3) + self.assertEqual(task.run(path), 3) def test_run_with_result_callback(self): class C(object): @@ -3725,9 +3725,9 @@ calls = [] result_callback = lambda result: calls.append(result) task = PathExecuter(result_callback) - self.assertEquals(task.get_result_callback(), result_callback) - self.assertEquals(task.run(path), 42) - self.assertEquals(calls, [42]) + self.assertEqual(task.get_result_callback(), result_callback) + self.assertEqual(task.run(path), 42) + self.assertEqual(calls, [42]) class OrdererTest(TestCase): @@ -3742,7 +3742,7 @@ self.assertTrue(isinstance(Orderer(self.path), Task)) def test_path(self): - self.assertEquals(Orderer(self.path).path, self.path) + self.assertEqual(Orderer(self.path).path, self.path) def test_has_run(self): orderer = Orderer(self.path) @@ -3770,7 +3770,7 @@ orderer = Orderer(self.path) orderer.add_dependency(1) orderer.add_dependency(2) - self.assertEquals(orderer.get_dependencies(), [1, 2]) + self.assertEqual(orderer.get_dependencies(), [1, 2]) def test_may_run(self): orderer1 = Orderer(self.path) @@ -3787,8 +3787,8 @@ orderer2.add_dependency(orderer1) try: orderer2.run(None) - except AssertionError, e: - self.assertEquals(str(e), "Should be after: path1") + except AssertionError as e: + self.assertEqual(str(e), "Should be after: path1") else: self.fail("AssertionError not raised") @@ -3825,7 +3825,7 @@ for method_name in method_names: task = SpecChecker(getattr(self.cls, method_name, None)) path = eval("self.path(%s)" % args_expr) - self.assertEquals(task.may_run(path), True) + self.assertEqual(task.may_run(path), True) try: task.run(path) except AssertionError: @@ -3838,7 +3838,7 @@ for method_name in method_names: task = SpecChecker(getattr(self.cls, method_name, None)) path = eval("self.path(%s)" % args_expr) - self.assertEquals(task.may_run(path), False) + self.assertEqual(task.may_run(path), False) try: task.run(path) except AssertionError: @@ -3849,7 +3849,7 @@ def test_get_method(self): task = SpecChecker(self.cls.noargs) - self.assertEquals(task.get_method(), self.cls.noargs) + self.assertEqual(task.get_method(), self.cls.noargs) def test_is_standard_recorder(self): self.assertTrue(spec_checker_recorder in Mocker.get_recorders()) @@ -3861,8 +3861,8 @@ task = SpecChecker(self.cls.normal) try: task.run(self.path(1)) - except AssertionError, e: - self.assertEquals(str(e), "Specification is normal(a, b, c=3): " + except AssertionError as e: + self.assertEqual(str(e), "Specification is normal(a, b, c=3): " "'b' not provided") else: self.fail("AssertionError not raised") @@ -3871,8 +3871,8 @@ task = SpecChecker(None) try: task.verify() - except AssertionError, e: - self.assertEquals(str(e), "Method not found in real specification") + except AssertionError as e: + self.assertEqual(str(e), "Method not found in real specification") else: self.fail("AssertionError not raised") @@ -3884,7 +3884,7 @@ try: task = SpecChecker(adler32) task.run(self.path("asd")) - except TypeError, e: + except TypeError as e: self.fail("TypeError: %s" % str(e)) def test_recorder(self): @@ -3892,45 +3892,45 @@ obj = self.mocker.mock(spec=self.cls) obj.noargs() getattr, call = self.mocker.get_events() - self.assertEquals(getattr.get_tasks(), []) + self.assertEqual(getattr.get_tasks(), []) (task,) = call.get_tasks() - self.assertEquals(type(task), SpecChecker) - self.assertEquals(task.get_method(), self.cls.noargs) + self.assertEqual(type(task), SpecChecker) + self.assertEqual(task.get_method(), self.cls.noargs) def test_recorder_with_unexistent_method(self): self.mocker.add_recorder(spec_checker_recorder) obj = self.mocker.mock(spec=self.cls) obj.unexistent() getattr, call = self.mocker.get_events() - self.assertEquals(getattr.get_tasks(), []) + self.assertEqual(getattr.get_tasks(), []) (task,) = call.get_tasks() - self.assertEquals(type(task), SpecChecker) - self.assertEquals(task.get_method(), None) + self.assertEqual(type(task), SpecChecker) + self.assertEqual(task.get_method(), None) def test_recorder_second_action_isnt_call(self): self.mocker.add_recorder(spec_checker_recorder) obj = self.mocker.mock(spec=self.cls) obj.noargs.x event1, event2 = self.mocker.get_events() - self.assertEquals(event1.get_tasks(), []) - self.assertEquals(event2.get_tasks(), []) + self.assertEqual(event1.get_tasks(), []) + self.assertEqual(event2.get_tasks(), []) def test_recorder_first_action_isnt_getattr(self): self.mocker.add_recorder(spec_checker_recorder) obj = self.mocker.mock(spec=self.cls) obj.__mocker_act__("anyother", ("attr",))() event1, event2 = self.mocker.get_events() - self.assertEquals(event1.get_tasks(), []) - self.assertEquals(event2.get_tasks(), []) + self.assertEqual(event1.get_tasks(), []) + self.assertEqual(event2.get_tasks(), []) def test_recorder_more_than_two_actions(self): self.mocker.add_recorder(spec_checker_recorder) obj = self.mocker.mock(spec=self.cls) obj.noargs().x event1, event2, event3 = self.mocker.get_events() - self.assertEquals(len(event1.get_tasks()), 0) - self.assertEquals(len(event2.get_tasks()), 1) - self.assertEquals(len(event3.get_tasks()), 0) + self.assertEqual(len(event1.get_tasks()), 0) + self.assertEqual(len(event2.get_tasks()), 1) + self.assertEqual(len(event3.get_tasks()), 0) def test_recorder_with_call_on_object(self): self.mocker.add_recorder(spec_checker_recorder) @@ -3938,16 +3938,16 @@ obj() (call,) = self.mocker.get_events() (task,) = call.get_tasks() - self.assertEquals(type(task), SpecChecker) - self.assertEquals(task.get_method(), self.cls.__call__) + self.assertEqual(type(task), SpecChecker) + self.assertEqual(task.get_method(), self.cls.__call__) def test_recorder_more_than_one_action_with_direct_call(self): self.mocker.add_recorder(spec_checker_recorder) obj = self.mocker.mock(spec=self.cls) obj().x event1, event2 = self.mocker.get_events() - self.assertEquals(len(event1.get_tasks()), 1) - self.assertEquals(len(event2.get_tasks()), 0) + self.assertEqual(len(event1.get_tasks()), 1) + self.assertEqual(len(event2.get_tasks()), 0) def test_noargs(self): methods = ["noargs", "klassnoargs", "staticnoargs"] @@ -4016,31 +4016,31 @@ def test_mock(self): mock = object() task = ProxyReplacer(mock) - self.assertEquals(task.mock, mock) + self.assertEqual(task.mock, mock) def test_defaults_to_not_installed(self): import calendar - self.assertEquals(type(calendar), ModuleType) + self.assertEqual(type(calendar), ModuleType) def test_install(self): self.task.replay() import calendar - self.assertEquals(type(calendar), Mock) + self.assertEqual(type(calendar), Mock) self.assertTrue(calendar is self.mock) def test_install_protects_mock(self): self.task.replay() - self.assertEquals(type(self.mock.__mocker_object__), ModuleType) + self.assertEqual(type(self.mock.__mocker_object__), ModuleType) def test_install_protects_path(self): self.task.replay() - self.assertEquals(type(self.mock.__mocker_path__.root_object), + self.assertEqual(type(self.mock.__mocker_path__.root_object), ModuleType) def test_deinstall_protects_task(self): self.task.replay() self.task.restore() - self.assertEquals(type(self.task.mock), Mock) + self.assertEqual(type(self.task.mock), Mock) def test_install_protects_anything_with_mocker_replace_false(self): class C(object): @@ -4050,7 +4050,7 @@ self.__mocker_replace__ = False obj = C() self.task.replay() - self.assertEquals(type(self.mock.__mocker_path__.root_object), + self.assertEqual(type(self.mock.__mocker_path__.root_object), ModuleType) def test_install_on_object(self): @@ -4060,7 +4060,7 @@ self.calendar = calendar obj = C() self.task.replay() - self.assertEquals(type(obj.calendar), Mock) + self.assertEqual(type(obj.calendar), Mock) self.assertTrue(obj.calendar is self.mock) def test_install_on_submodule(self): @@ -4069,7 +4069,7 @@ task = ProxyReplacer(mock) task.replay() try: - self.assertEquals(type(os.path), Mock) + self.assertEqual(type(os.path), Mock) self.assertTrue(os.path is mock) finally: task.restore() @@ -4078,8 +4078,8 @@ self.task.replay() self.task.restore() import calendar - self.assertEquals(type(calendar), ModuleType) - self.assertEquals(calendar.__name__, "calendar") + self.assertEqual(type(calendar), ModuleType) + self.assertEqual(calendar.__name__, "calendar") def test_uninstall_from_object(self): class C(object): @@ -4089,17 +4089,17 @@ obj = C() self.task.replay() self.task.restore() - self.assertEquals(type(obj.calendar), ModuleType) - self.assertEquals(obj.calendar.__name__, "calendar") + self.assertEqual(type(obj.calendar), ModuleType) + self.assertEqual(obj.calendar.__name__, "calendar") def test_uninstall_from_submodule(self): from os import path mock = Mock(self.mocker, object=path) task = ProxyReplacer(mock) - self.assertEquals(type(os.path), ModuleType) + self.assertEqual(type(os.path), ModuleType) task.replay() task.restore() - self.assertEquals(type(os.path), ModuleType) + self.assertEqual(type(os.path), ModuleType) class PatcherTest(TestCase): @@ -4121,7 +4121,7 @@ self.assertTrue(isinstance(Patcher(), Task)) def test_undefined_repr(self): - self.assertEquals(repr(Undefined), "Undefined") + self.assertEqual(repr(Undefined), "Undefined") def test_is_monitoring_unseen_class_kind(self): self.assertFalse(self.patcher.is_monitoring(self.C, "kind")) @@ -4155,7 +4155,7 @@ def test_patch_attr(self): self.patcher.patch_attr(self.C, "attr", "patch") - self.assertEquals(self.C.__dict__.get("attr"), "patch") + self.assertEqual(self.C.__dict__.get("attr"), "patch") def test_patch_attr_and_restore(self): self.patcher.patch_attr(self.C, "attr", "patch") @@ -4166,58 +4166,58 @@ self.C.attr = "original" self.patcher.patch_attr(self.C, "attr", "patch") self.patcher.restore() - self.assertEquals(self.C.__dict__.get("attr"), "original") + self.assertEqual(self.C.__dict__.get("attr"), "original") def test_get_unpatched_attr_unpatched_undefined(self): - self.assertEquals(self.patcher.get_unpatched_attr(self.C, "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.C, "attr"), Undefined) def test_get_unpatched_attr_unpatched(self): self.C.attr = "original" - self.assertEquals(self.patcher.get_unpatched_attr(self.C, "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.C, "attr"), "original") def test_get_unpatched_attr_defined_on_superclass(self): self.C.attr = "original" - self.assertEquals(self.patcher.get_unpatched_attr(self.D, "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.D, "attr"), "original") def test_get_unpatched_attr_defined_on_superclass_patched_on_sub(self): self.C.attr = "original" self.patcher.patch_attr(self.D, "attr", "patch") - self.assertEquals(self.patcher.get_unpatched_attr(self.D, "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.D, "attr"), "original") def test_get_unpatched_attr_patched_originally_undefined(self): self.patcher.patch_attr(self.C, "attr", "patch") - self.assertEquals(self.patcher.get_unpatched_attr(self.C, "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.C, "attr"), Undefined) def test_get_unpatched_attr_patched(self): self.C.attr = "original" self.patcher.patch_attr(self.C, "attr", "patch") - self.assertEquals(self.patcher.get_unpatched_attr(self.C, "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.C, "attr"), "original") def test_get_unpatched_attr_on_instance_originally_undefined(self): - self.assertEquals(self.patcher.get_unpatched_attr(self.C(), "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.C(), "attr"), Undefined) def test_get_unpatched_attr_on_instance(self): self.C.attr = "original" - self.assertEquals(self.patcher.get_unpatched_attr(self.D(), "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.D(), "attr"), "original") def test_get_unpatched_attr_on_instance_defined_on_superclass(self): self.C.attr = "original" self.patcher.patch_attr(self.C, "attr", "patch") - self.assertEquals(self.patcher.get_unpatched_attr(self.D(), "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.D(), "attr"), "original") def test_get_unpatched_attr_on_instance_with_descriptor(self): self.C.attr = property(lambda self: "original") self.patcher.patch_attr(self.C, "attr", "patch") - self.assertEquals(self.patcher.get_unpatched_attr(self.D(), "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.D(), "attr"), "original") def test_get_unpatched_attr_on_subclass_with_descriptor(self): @@ -4228,9 +4228,9 @@ return "original" self.C.attr = Property() self.patcher.patch_attr(self.C, "attr", "patch") - self.assertEquals(self.patcher.get_unpatched_attr(self.D, "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.D, "attr"), "original") - self.assertEquals(calls, [(None, self.D)]) + self.assertEqual(calls, [(None, self.D)]) def test_get_unpatched_attr_on_instance_with_fake_descriptor(self): class BadProperty(object): @@ -4240,23 +4240,23 @@ prop = BadProperty() self.C.attr = prop self.patcher.patch_attr(self.C, "attr", "patch") - self.assertEquals(self.patcher.get_unpatched_attr(self.D(), "attr"), + self.assertEqual(self.patcher.get_unpatched_attr(self.D(), "attr"), prop) def test_replay_with_monitored_class(self): self.patcher.monitor(self.C, "call") self.patcher.replay() - self.assertEquals(type(self.C.__dict__["__call__"]), PatchedMethod) + self.assertEqual(type(self.C.__dict__["__call__"]), PatchedMethod) def test_replay_with_monitored_instance(self): self.patcher.monitor(self.C(), "call") self.patcher.replay() - self.assertEquals(type(self.C.__dict__["__call__"]), PatchedMethod) + self.assertEqual(type(self.C.__dict__["__call__"]), PatchedMethod) def test_replay_getattr(self): self.patcher.monitor(self.C, "getattr") self.patcher.replay() - self.assertEquals(type(self.C.__dict__["__getattribute__"]), + self.assertEqual(type(self.C.__dict__["__getattribute__"]), PatchedMethod) def test_restore(self): @@ -4279,7 +4279,7 @@ obj.__mocker_mock__ = self.MockStub() self.patcher.replay() result = obj(1, a=2) - self.assertEquals(result, ("call", (1,), {"a": 2}, obj)) + self.assertEqual(result, ("call", (1,), {"a": 2}, obj)) def test_patched_call_on_class(self): self.patcher.monitor(self.C, "call") @@ -4287,7 +4287,7 @@ self.patcher.replay() obj = self.C() result = obj(1, a=2) - self.assertEquals(result, ("call", (1,), {"a": 2}, obj)) + self.assertEqual(result, ("call", (1,), {"a": 2}, obj)) def test_patched_call_on_class_edge_case(self): """Only "getattr" kind should passthrough on __mocker_* arguments.""" @@ -4296,7 +4296,7 @@ self.patcher.replay() obj = self.C() result = obj("__mocker_mock__") - self.assertEquals(result, ("call", ("__mocker_mock__",), {}, obj)) + self.assertEqual(result, ("call", ("__mocker_mock__",), {}, obj)) def test_patched_getattr_on_class(self): self.patcher.monitor(self.C, "getattr") @@ -4304,7 +4304,7 @@ self.patcher.replay() obj = self.C() result = obj.attr - self.assertEquals(result, ("getattr", ("attr",), {}, obj)) + self.assertEqual(result, ("getattr", ("attr",), {}, obj)) def test_patched_getattr_on_unmonitored_object(self): obj1 = self.C() @@ -4313,8 +4313,8 @@ obj2 = self.C() obj2.attr = "original" self.patcher.replay() - self.assertEquals(obj1.attr, ("getattr", ("attr",), {}, obj1)) - self.assertEquals(obj2.attr, "original") + self.assertEqual(obj1.attr, ("getattr", ("attr",), {}, obj1)) + self.assertEqual(obj2.attr, "original") def test_patched_getattr_on_different_instances(self): def build_getattr(original): @@ -4343,15 +4343,15 @@ self.patcher.monitor(obj8, "getattr") self.patcher.replay() - self.assertEquals(obj1.attr, "originalC") - self.assertEquals(obj2.attr, 2) - self.assertEquals(obj3.attr, "originalC") - self.assertEquals(obj4.attr, "originalC") - self.assertEquals(obj5.attr, 5) - self.assertEquals(obj6.attr, "originalC") - self.assertEquals(obj7.attr, "originalD") - self.assertEquals(obj8.attr, 8) - self.assertEquals(obj9.attr, "originalD") + self.assertEqual(obj1.attr, "originalC") + self.assertEqual(obj2.attr, 2) + self.assertEqual(obj3.attr, "originalC") + self.assertEqual(obj4.attr, "originalC") + self.assertEqual(obj5.attr, 5) + self.assertEqual(obj6.attr, "originalC") + self.assertEqual(obj7.attr, "originalD") + self.assertEqual(obj8.attr, 8) + self.assertEqual(obj9.attr, "originalD") def test_patched_getattr_execute_getattr(self): class C(object): @@ -4362,7 +4362,7 @@ obj = C() self.patcher.monitor(obj, "getattr") self.patcher.replay() - self.assertEquals(self.patcher.execute(action, obj), "original") + self.assertEqual(self.patcher.execute(action, obj), "original") def test_execute_getattr_on_unexistent(self): action = Action("getattr", ("attr",), {}) @@ -4398,15 +4398,15 @@ self.patcher.monitor(obj8, "getattr") self.patcher.replay() - self.assertEquals(obj1.attr, "originalC") - self.assertEquals(obj2.attr, 2) - self.assertEquals(obj3.attr, "originalC") - self.assertEquals(obj4.attr, "originalC") - self.assertEquals(obj5.attr, 5) - self.assertEquals(obj6.attr, "originalC") - self.assertEquals(obj7.attr, "originalD") - self.assertEquals(obj8.attr, 8) - self.assertEquals(obj9.attr, "originalD") + self.assertEqual(obj1.attr, "originalC") + self.assertEqual(obj2.attr, 2) + self.assertEqual(obj3.attr, "originalC") + self.assertEqual(obj4.attr, "originalC") + self.assertEqual(obj5.attr, 5) + self.assertEqual(obj6.attr, "originalC") + self.assertEqual(obj7.attr, "originalD") + self.assertEqual(obj8.attr, 8) + self.assertEqual(obj9.attr, "originalD") def test_patched_real_getattr_execute_getattr(self): class C(object): @@ -4417,7 +4417,7 @@ obj = C() self.patcher.monitor(obj, "getattr") self.patcher.replay() - self.assertEquals(self.patcher.execute(action, obj), "original") + self.assertEqual(self.patcher.execute(action, obj), "original") def test_execute_call(self): class C(object): @@ -4427,7 +4427,7 @@ obj = C() self.patcher.monitor(obj, "call") self.patcher.replay() - self.assertEquals(self.patcher.execute(action, obj), ((1,), {"a": 2})) + self.assertEqual(self.patcher.execute(action, obj), ((1,), {"a": 2})) def test_recorder_class_getattr(self): self.C.method = lambda: None @@ -4435,7 +4435,7 @@ mock.method() self.mocker.result("mocked") self.mocker.replay() - self.assertEquals(self.C().method(), "mocked") + self.assertEqual(self.C().method(), "mocked") self.assertRaises(AssertionError, self.C().method) def test_recorder_instance_getattr(self): @@ -4446,9 +4446,9 @@ mock.attr self.mocker.result("mocked") self.mocker.replay() - self.assertEquals(obj1.attr, "mocked") + self.assertEqual(obj1.attr, "mocked") self.assertRaises(AssertionError, getattr, obj1, "attr") - self.assertEquals(obj2.attr, "original") + self.assertEqual(obj2.attr, "original") self.assertRaises(AttributeError, getattr, obj1, "unexistent") def test_recorder_passthrough(self): @@ -4462,7 +4462,7 @@ self.mocker.passthrough() self.mocker.replay() obj = C() - self.assertEquals(obj.method(), "original") + self.assertEqual(obj.method(), "original") self.assertRaises(AssertionError, obj.method) def test_original_exception_raised(self): @@ -4476,29 +4476,29 @@ obj = C() try: obj.use_non_existing_attribute() - except AttributeError, error: + except AttributeError as error: mRefactoringTool: No changes to ./setup.py RefactoringTool: Refactored ./mocker.py essage = "'C' object has no attribute 'bad_attribute'" - self.assertEquals(message, str(error)) + self.assertEqual(message, str(error)) def main(): try: unittest.main() finally: - print + print() if coverage: coverage.stop() (filename, executed, missing, missing_human) = coverage.analysis("mocker.py") if missing: - print "WARNING: Some statements were not executed:" - print + print("WARNING: Some statements were not executed:") + print() coverage.report(["mocker.py"]) else: - print "Tests covered 100% of statements!" - else: - print "WARNING: No coverage test performed (missing coverage.py)" - print + print("Tests covered 100% of statements!") + else: + print("WARNING: No coverage test performed (missing coverage.py)") + print() if __name__ == "__main__": --- ./mocker.py (original) +++ ./mocker.py (refactored) @@ -31,7 +31,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ -import __builtin__ +import builtins import tempfile import unittest import inspect @@ -332,7 +332,7 @@ """ first_methods = dict(inspect.getmembers(first, inspect.ismethod)) second_methods = dict(inspect.getmembers(second, inspect.ismethod)) - for name, first_method in first_methods.iteritems(): + for name, first_method in first_methods.items(): first_argspec = inspect.getargspec(first_method) first_formatted = inspect.formatargspec(*first_argspec) @@ -393,7 +393,7 @@ callableObj = args[0] try: result = callableObj(*args[1:], **kwargs) - except excClass, e: + except excClass as e: match_regexp(e) return e else: @@ -450,8 +450,8 @@ assertNotIsInstance = failIfIsInstance # Poor choice in 2.7/3.2+. # The following are missing in Python < 2.4. - assertTrue = unittest.TestCase.failUnless - assertFalse = unittest.TestCase.failIf + assertTrue = unittest.TestCase.assertTrue + assertFalse = unittest.TestCase.assertFalse # The following is provided for compatibility with Twisted's trial. assertIdentical = assertIs @@ -631,7 +631,7 @@ for event in self._events: try: event.verify() - except AssertionError, e: + except AssertionError as e: error = str(e) if not error: raise RuntimeError("Empty error message from %r" @@ -706,7 +706,7 @@ explicitly requested via the L{passthrough()} method. """ - if isinstance(object, basestring): + if isinstance(object, str): if name is None: name = object import_stack = object.split(".") @@ -726,11 +726,11 @@ object = getattr(object, attr) break if isinstance(object, types.UnboundMethodType): - object = object.im_func + object = object.__func__ if spec is True: spec = object if type is True: - type = __builtin__.type(object) + type = builtins.type(object) return Mock(self, spec=spec, type=type, object=object, name=name, count=count, passthrough=passthrough) @@ -1182,7 +1182,7 @@ path.root_object = object try: return self.__mocker__.act(path) - except MatchError, exception: + except MatchError as exception: root_mock = path.root_mock if (path.root_object is not None and root_mock.__mocker_passthrough__): @@ -1190,7 +1190,7 @@ # Reinstantiate to show raise statement on traceback, and # also to make the traceback shown shorter. raise MatchError(str(exception)) - except AssertionError, e: + except AssertionError as e: lines = str(e).splitlines() message = [ERROR_PREFIX + "Unmet expectation:", ""] message.append("=> " + lines.pop(0)) @@ -1240,16 +1240,16 @@ # something that doesn't offer them. try: result = self.__mocker_act__("len") - except MatchError, e: + except MatchError as e: raise AttributeError(str(e)) if type(result) is Mock: return 0 return result - def __nonzero__(self): + def __bool__(self): try: result = self.__mocker_act__("nonzero") - except MatchError, e: + except MatchError as e: return True if type(result) is Mock: return True @@ -1275,13 +1275,13 @@ frame = sys._getframe(depth+1) except: return None - for name, frame_obj in frame.f_locals.iteritems(): + for name, frame_obj in frame.f_locals.items(): if frame_obj is obj: return name self = frame.f_locals.get("self") if self is not None: try: - items = list(self.__dict__.iteritems()) + items = list(self.__dict__.items()) except: pass else: @@ -1430,7 +1430,7 @@ result = "del %s.%s" % (result, action.args[0]) elif action.kind == "call": args = [repr(x) for x in action.args] - items = list(action.kwargs.iteritems()) + items = list(action.kwargs.items()) items.sort() for pair in items: args.append("%s=%r" % pair) @@ -1550,7 +1550,7 @@ # Either we have the same number of kwargs, or unknown keywords are # accepted (KWARGS was used), so check just the ones in kwargs1. - for key, arg1 in kwargs1.iteritems(): + for key, arg1 in kwargs1.items(): if key not in kwargs2: return False arg2 = kwargs2[key] @@ -1692,7 +1692,7 @@ if not errors or not task.may_run_user_code(): try: task_result = task.run(path) - except AssertionError, e: + except AssertionError as e: error = str(e) if not error: raise RuntimeError("Empty error message from %r" % task) @@ -1739,7 +1739,7 @@ for task in self._tasks: try: task.verify() - except AssertionError, e: + except AssertionError as e: error = str(e) if not error: raise RuntimeError("Empty error message from %r" % task) @@ -1858,7 +1858,7 @@ def __init__(self, min, max=False): self.min = min if max is None: - self.max = sys.maxint + self.max = sys.maxsize elif max is False: self.max = min else: @@ -2115,7 +2115,7 @@ for referrer in gc.get_referrers(remove): if (type(referrer) is dict and referrer.get("__mocker_replace__", True)): - for key, value in list(referrer.iteritems()): + for key, value in list(referrer.items()): if value is remove: referrer[key] = install @@ -2187,7 +2187,7 @@ for kind in self._monitored: attr = self._get_kind_attr(kind) seen = set() - for obj in self._monitored[kind].itervalues(): + for obj in self._monitored[kind].values(): cls = type(obj) if issubclass(cls, type): cls = obj @@ -2201,7 +2201,7 @@ self.execute) def restore(self): - for obj, attr, original in self._patched.itervalues(): + for obj, attr, original in self._RefactoringTool: Files that were modified: RefactoringTool: ./test.py RefactoringTool: ./setup.py RefactoringTool: ./mocker.py patched.values(): if original is Undefined: delattr(obj, attr) else: @@ -2226,7 +2226,7 @@ pass else: return __getattr__(*action.args, **action.kwargs) - raise type, value, traceback + raise type(value).with_traceback(traceback) class PatchedMethod(object): + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.33417 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python3-module-mocker-1.1.1 + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python3 setup.py build running build running build_py creating build creating build/lib copying mocker.py -> build/lib + exit 0 Executing(%install): /bin/sh -e /usr/src/tmp/rpm-tmp.46301 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + /bin/chmod -Rf u+rwX -- /usr/src/tmp/python3-module-mocker-buildroot + : + /bin/rm -rf -- /usr/src/tmp/python3-module-mocker-buildroot + cd python3-module-mocker-1.1.1 + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python3 setup.py install --skip-build --root=/usr/src/tmp/python3-module-mocker-buildroot --force running install running install_lib creating /usr/src/tmp/python3-module-mocker-buildroot creating /usr/src/tmp/python3-module-mocker-buildroot/usr creating /usr/src/tmp/python3-module-mocker-buildroot/usr/lib creating /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3 creating /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages copying build/lib/mocker.py -> /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages byte-compiling /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py to mocker.cpython-36.pyc running install_egg_info running egg_info creating mocker.egg-info writing mocker.egg-info/PKG-INFO writing dependency_links to mocker.egg-info/dependency_links.txt writing top-level names to mocker.egg-info/top_level.txt writing manifest file 'mocker.egg-info/SOURCES.txt' reading manifest file 'mocker.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'mocker.egg-info/SOURCES.txt' Copying mocker.egg-info to /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker-1.1.1-py3.6.egg-info running install_scripts + /usr/lib/rpm/brp-alt Cleaning files in /usr/src/tmp/python3-module-mocker-buildroot (auto) Verifying and fixing files in /usr/src/tmp/python3-module-mocker-buildroot (binconfig,pkgconfig,libtool,desktop) Checking contents of files in /usr/src/tmp/python3-module-mocker-buildroot/ (default) Compressing files in /usr/src/tmp/python3-module-mocker-buildroot (auto) Adjusting library links in /usr/src/tmp/python3-module-mocker-buildroot ./usr/lib: Verifying ELF objects in /usr/src/tmp/python3-module-mocker-buildroot (arch=normal,fhs=normal,lfs=relaxed,lint=relaxed,rpath=normal,stack=normal,textrel=normal,unresolved=normal) Bytecompiling python modules in /usr/src/tmp/python3-module-mocker-buildroot using /usr/bin/python Bytecompiling python modules with optimization in /usr/src/tmp/python3-module-mocker-buildroot using /usr/bin/python -O Bytecompiling python3 modules in /usr/src/tmp/python3-module-mocker-buildroot using /usr/bin/python3 unlink /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/__pycache__/mocker.cpython-36.pyc compile /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py Bytecompiling python3 modules with optimization in /usr/src/tmp/python3-module-mocker-buildroot using /usr/bin/python3 -O compile /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py Bytecompiling python3 modules with optimization-2 in /usr/src/tmp/python3-module-mocker-buildroot using /usr/bin/python3 -OO compile /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py Hardlinking identical .pyc and .opt-?.pyc files './usr/lib/python3/site-packages/__pycache__/mocker.cpython-36.opt-1.pyc' => './usr/lib/python3/site-packages/__pycache__/mocker.cpython-36.pyc' Hardlinking identical .pyc and .pyo files Processing files: python3-module-mocker-1.1.1-alt1.bzr20130910.1.2 Executing(%doc): /bin/sh -e /usr/src/tmp/rpm-tmp.39666 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python3-module-mocker-1.1.1 + DOCDIR=/usr/src/tmp/python3-module-mocker-buildroot/usr/share/doc/python3-module-mocker-1.1.1 + export DOCDIR + rm -rf /usr/src/tmp/python3-module-mocker-buildroot/usr/share/doc/python3-module-mocker-1.1.1 + /bin/mkdir -p /usr/src/tmp/python3-module-mocker-buildroot/usr/share/doc/python3-module-mocker-1.1.1 + cp -prL NEWS LICENSE README.md /usr/src/tmp/python3-module-mocker-buildroot/usr/share/doc/python3-module-mocker-1.1.1 + chmod -R go-w /usr/src/tmp/python3-module-mocker-buildroot/usr/share/doc/python3-module-mocker-1.1.1 + chmod -R a+rX /usr/src/tmp/python3-module-mocker-buildroot/usr/share/doc/python3-module-mocker-1.1.1 + exit 0 Finding Provides (using /usr/lib/rpm/find-provides) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.q6acfl find-provides: running scripts (alternatives,debuginfo,lib,pam,perl,pkgconfig,python,python3,shell) Finding Requires (using /usr/lib/rpm/find-requires) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.QuiR3s find-requires: running scripts (cpp,debuginfo,files,lib,pam,perl,pkgconfig,pkgconfiglib,python,python3,rpmlib,shebang,shell,static,symlinks) python3.req: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: skipping builtins python3.req: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: skipping sys python3.req: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: skipping gc /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=47 IGNORE (for REQ=slight and deep=8) module=sets /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [269, [270, [271, [272, [274, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]]]]]]]], [4, '', 717]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [270, [271, [272, [274, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]]]]]]]], [4, '', 717]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [271, [272, [274, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [272, [274, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [274, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [317, [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [318, [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [319, [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [320, [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [321, [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [322, [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]]] /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 UNABLE to determine the imported name at parse-time: module_path /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-mocker-buildroot/usr/lib/python3/site-packages/mocker.py: line=717 a form of __import__ was read which gave no deps: [323, [324, [1, '__import__', 717]], [326, [7, '(', 717], [334, [335, [305, [309, [310, [311, [312, [315, [316, [317, [318, [319, [320, [321, [322, [323, [324, [1, 'module_path', 717]]]]]]]]]]]]]]]]]], [8, ')', 717]]] Provides: python3(mocker) Requires: /usr/lib/python3/site-packages, python3(inspect) < 0, python3(os) < 0, python3(re) < 0, python3(shutil) < 0, python3(tempfile) < 0, python3(types) < 0, python3(unittest) < 0 Wrote: /usr/src/RPM/RPMS/noarch/python3-module-mocker-1.1.1-alt1.bzr20130910.1.2.noarch.rpm 15.34user 0.36system 0:24.45elapsed 64%CPU (0avgtext+0avgdata 53336maxresident)k 0inputs+0outputs (0major+147852minor)pagefaults 0swaps 27.53user 3.04system 0:48.87elapsed 62%CPU (0avgtext+0avgdata 122608maxresident)k 72inputs+0outputs (0major+639975minor)pagefaults 0swaps