mirror of https://github.com/zulip/zulip.git
lint/tests: Give nice error message for common import failures.
This should make users much more likely to be able to debug issues where they ran Zulip outside the Vagrant environment or virtualenv. [error messages tweaked by tabbott]
This commit is contained in:
parent
0ab6b99cbb
commit
ffb2f9e84b
|
@ -1,12 +1,18 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
|
||||||
import optparse
|
import optparse
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
|
try:
|
||||||
|
import requests
|
||||||
|
except ImportError as e:
|
||||||
|
print("ImportError: {}".format(e))
|
||||||
|
print("You need to run the Zulip tests inside a Zulip dev environment.")
|
||||||
|
print("If you are using Vagrant, you can `vagrant ssh` to enter the Vagrant guest.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
#
|
#
|
||||||
# In order to use remote casperjs debugging, pass the --remote-debug flag
|
# In order to use remote casperjs debugging, pass the --remote-debug flag
|
||||||
|
|
|
@ -7,8 +7,13 @@ import sys
|
||||||
import optparse
|
import optparse
|
||||||
import subprocess
|
import subprocess
|
||||||
import traceback
|
import traceback
|
||||||
|
try:
|
||||||
import lister
|
import lister
|
||||||
|
except ImportError as e:
|
||||||
|
print("ImportError: {}".format(e))
|
||||||
|
print("You need to run the Zulip linters inside a Zulip dev environment.")
|
||||||
|
print("If you are using Vagrant, you can `vagrant ssh` to enter the Vagrant guest.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option('--full',
|
parser.add_option('--full',
|
||||||
|
|
|
@ -6,9 +6,15 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import django
|
try:
|
||||||
from django.conf import settings
|
import django
|
||||||
from django.test.utils import get_runner
|
from django.conf import settings
|
||||||
|
from django.test.utils import get_runner
|
||||||
|
except ImportError as e:
|
||||||
|
print("ImportError: {}".format(e))
|
||||||
|
print("You need to run the Zulip tests inside a Zulip dev environment.")
|
||||||
|
print("If you are using Vagrant, you can `vagrant ssh` to enter the Vagrant guest.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
Loading…
Reference in New Issue