tools: Fix running full-stack tests from tools/ directory.

Previously these tests required you to run them with the root of the
Zulip repository as the current working directory, just due to
sloppiness.

We clean this up, while also making the path handling more consistent
and involving less fragile code.

Fixes #4169.
This commit is contained in:
Tim Abbott
2017-08-27 16:03:45 -07:00
parent bd7d9da668
commit 02d931a53e
3 changed files with 12 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ import subprocess
import time
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# check for the venv
from lib import sanity_check
@@ -21,9 +22,8 @@ parser.add_option('--force', default=False,
help='Run tests despite possible problems.')
(options, args) = parser.parse_args()
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
os.chdir(ZULIP_PATH)
sys.path.insert(0, ZULIP_PATH)
from tools.lib.test_server import test_server_running
subprocess.check_call(['mkdir', '-p', 'var/help-documentation'])