commit 45e88d45da2e5693108d56ac4a44884b45045e0a Author: Damian Johnson atagar@torproject.org Date: Tue Sep 25 15:56:55 2018 -0700
Compare exit policy strings in unit tests
Oops, my prior commit made jenkins sad...
====================================================================== FAIL: test_get_exit_policy_if_not_relaying ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 1305, in patched return func(*args, **keywargs) File "/srv/jenkins-workspace/workspace/stem-tor-ci/test/unit/control/controller.py", line 247, in test_get_exit_policy_if_not_relaying self.assertEqual(expected, self.controller.get_exit_policy()) AssertionError: <stem.exit_policy.ExitPolicy object at 0x7f680846e550> != <stem.exit_policy.ExitPolicy object at 0x7f6808399650>
----------------------------------------------------------------------
No doubt I'm missing a mock. This isn't gonna fix that, but this should make the assertion failure more helpful. --- test/unit/control/controller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/unit/control/controller.py b/test/unit/control/controller.py index 0ae9fafd..29be956f 100644 --- a/test/unit/control/controller.py +++ b/test/unit/control/controller.py @@ -196,7 +196,7 @@ class TestControl(unittest.TestCase): 'accept *:*', )
- self.assertEqual(expected, self.controller.get_exit_policy()) + self.assertEqual(str(expected), str(self.controller.get_exit_policy()))
@patch('stem.control.Controller.get_info') @patch('stem.control.Controller.get_conf') @@ -244,10 +244,10 @@ class TestControl(unittest.TestCase): get_info_mock.side_effect = getinfo_response
exit_policy_exception = stem.OperationFailed('552', 'Not running in server mode') - self.assertEqual(expected, self.controller.get_exit_policy()) + self.assertEqual(str(expected), str(self.controller.get_exit_policy()))
exit_policy_exception = stem.OperationFailed('551', 'Descriptor still rebuilding - not ready yet') - self.assertEqual(expected, self.controller.get_exit_policy()) + self.assertEqual(str(expected), str(self.controller.get_exit_policy()))
@patch('stem.control.Controller.get_info') @patch('stem.control.Controller.get_conf')
tor-commits@lists.torproject.org