From 7ab190338d7b41bc6ae057a2a2f2e1e3f30038e7 Mon Sep 17 00:00:00 2001 From: John Vrbanac Date: Sat, 13 Sep 2014 14:54:03 -0500 Subject: [PATCH] Fixing the PYTHONHASHSEED bug with our unittests Switching from HTTPInternalServerError to HTTPServerError as Pecan seems to be returning HTTPServerError instead. For some reason the assertion only fails with specific PYTHONHASHSEED's. As a result, I'm just making sure we assert against the returned exception to correct the issue for the moment. Change-Id: Iad15fa17fc2c4d5c3642462df25e702aaff4801f Partial-bug: #1348818 --- barbican/tests/api/test_resources_policy.py | 4 ++-- tox.ini | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/barbican/tests/api/test_resources_policy.py b/barbican/tests/api/test_resources_policy.py index 1c8c17a09..1953d68bc 100644 --- a/barbican/tests/api/test_resources_policy.py +++ b/barbican/tests/api/test_resources_policy.py @@ -154,7 +154,7 @@ class BaseTestCase(utils.BaseTestCase): """ # The 'Read Error' clause needs to match that asserted in # _assert_post_rbac_exception() above. - return exc.HTTPInternalServerError(message='Read Error') + return exc.HTTPServerError(message='Read Error') def _assert_pass_rbac(self, roles, method_under_test, accept=None, content_type=None): @@ -172,7 +172,7 @@ class BaseTestCase(utils.BaseTestCase): # Force an exception early past the RBAC passing. self.req.body_file = self._generate_stream_for_exit() - exception = self.assertRaises(exc.HTTPInternalServerError, + exception = self.assertRaises(exc.HTTPServerError, method_under_test) self._assert_post_rbac_exception(exception, role) diff --git a/tox.ini b/tox.ini index a3bde73cb..aedb1afe5 100644 --- a/tox.ini +++ b/tox.ini @@ -5,9 +5,6 @@ envlist = pep8,py26,py27,docs install_command = pip install -U {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -# Note the hash seed is set to 0 until barbican can be tested with a -# random hash seed successfully. -setenv = PYTHONHASHSEED=0 commands = python setup.py testr --coverage