From f3faad7ebc2157e7f2cf0dd1154f73e0b8baf2d8 Mon Sep 17 00:00:00 2001 From: George Song Date: Fri, 4 Aug 2017 07:15:44 -0700 Subject: [PATCH] Strip `c` from `.pyc` for error message comparison In Python 2.7, `__file__` returns `.pyc` by default, this breaks our comparison so let's strip out the trailing `c`. --- openedx/core/djangoapps/user_api/tests/test_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/user_api/tests/test_helpers.py b/openedx/core/djangoapps/user_api/tests/test_helpers.py index 2e4cc66fb0..d5babff60c 100644 --- a/openedx/core/djangoapps/user_api/tests/test_helpers.py +++ b/openedx/core/djangoapps/user_api/tests/test_helpers.py @@ -60,7 +60,7 @@ class InterceptErrorsTest(TestCase): u"keyword arguments '{{'raise_error': }}' " u"from File \"{}\", line XXX, in test_logs_errors\n" u" intercepted_function(raise_error=FakeInputException): FakeInputException()" - ).format(exception, __file__) + ).format(exception, __file__.rstrip('c')) # Verify that the raised exception has the error message try: