mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +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:
|
||||
# We are likely to get here only when running tests in serial
|
||||
# mode on Python 3.4 or lower.
|
||||
traceback.print_exc()
|
||||
print()
|
||||
print(" This is often caused by a test module/class/function that doesn't exist or ")
|
||||
print(" import properly. You can usually debug in a `./manage.py shell` via e.g. ")
|
||||
print(" import zerver.tests.test_messages")
|
||||
print(" from zerver.tests.test_messages import StreamMessagesTest")
|
||||
print(" StreamMessagesTest.test_message_to_stream")
|
||||
print()
|
||||
sys.exit(1)
|
||||
# test_labels are always normalized to include the correct prefix.
|
||||
# If we run the command with ./tools/test-backend test_alert_words,
|
||||
# test_labels will be equal to ['zerver.tests.test_alert_words'].
|
||||
for test_label in test_labels:
|
||||
check_import_error(test_label)
|
||||
|
||||
self.test_imports(test_labels, suite)
|
||||
if self.parallel == 1:
|
||||
|
||||
Reference in New Issue
Block a user