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`.
This commit is contained in:
George Song
2017-08-04 07:15:44 -07:00
parent 198dbc1e61
commit f3faad7ebc

View File

@@ -60,7 +60,7 @@ class InterceptErrorsTest(TestCase):
u"keyword arguments '{{'raise_error': <class '{}'>}}' "
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: