mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
tests: Give more descriptive import error.
This code takes care of the environment running Python 3.4 when test label is passed directly to the test-backend command: ./tools/test-backend test_alert_words
This commit is contained in:
@@ -446,15 +446,11 @@ class Runner(DiscoverRunner):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
# We are likely to get here only when running tests in serial
|
# We are likely to get here only when running tests in serial
|
||||||
# mode on Python 3.4 or lower.
|
# mode on Python 3.4 or lower.
|
||||||
traceback.print_exc()
|
# test_labels are always normalized to include the correct prefix.
|
||||||
print()
|
# If we run the command with ./tools/test-backend test_alert_words,
|
||||||
print(" This is often caused by a test module/class/function that doesn't exist or ")
|
# test_labels will be equal to ['zerver.tests.test_alert_words'].
|
||||||
print(" import properly. You can usually debug in a `./manage.py shell` via e.g. ")
|
for test_label in test_labels:
|
||||||
print(" import zerver.tests.test_messages")
|
check_import_error(test_label)
|
||||||
print(" from zerver.tests.test_messages import StreamMessagesTest")
|
|
||||||
print(" StreamMessagesTest.test_message_to_stream")
|
|
||||||
print()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
self.test_imports(test_labels, suite)
|
self.test_imports(test_labels, suite)
|
||||||
if self.parallel == 1:
|
if self.parallel == 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user