summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ce5813a)
Refs #2752. There's two pieces to this: pointing the Go tests at the
new home of run_test_server.py, and having run_test_server.py add the
arvados module source to sys.path as needed.
func pythonDir() string {
gopath := os.Getenv("GOPATH")
func pythonDir() string {
gopath := os.Getenv("GOPATH")
- return fmt.Sprintf("%s/../python", strings.Split(gopath, ":")[0])
+ return fmt.Sprintf("%s/../python/tests", strings.Split(gopath, ":")[0])
}
func (s *ServerRequiredSuite) SetUpSuite(c *C) {
}
func (s *ServerRequiredSuite) SetUpSuite(c *C) {
-import subprocess
-import time
+#!/usr/bin/env python
+
+import argparse
-import argparse
-import arvados.config
-import arvados.api
-import shutil
+import time
+import yaml
+
+MY_DIRNAME = os.path.dirname(os.path.realpath(__file__))
+if __name__ == '__main__' and os.path.exists(
+ os.path.join(MY_DIRNAME, '..', 'arvados', '__init__.py')):
+ # We're being launched to support another test suite.
+ # Add the Python SDK source to the library path.
+ sys.path.insert(1, os.path.dirname(MY_DIRNAME))
+
+import arvados.api
+import arvados.config
ARV_API_SERVER_DIR = '../../../services/api'
KEEP_SERVER_DIR = '../../../services/keep'
ARV_API_SERVER_DIR = '../../../services/api'
KEEP_SERVER_DIR = '../../../services/keep'
def run(websockets=False, reuse_server=False):
cwd = os.getcwd()
def run(websockets=False, reuse_server=False):
cwd = os.getcwd()
- os.chdir(os.path.join(os.path.dirname(__file__), ARV_API_SERVER_DIR))
+ os.chdir(os.path.join(MY_DIRNAME, ARV_API_SERVER_DIR))
if websockets:
pid_file = WEBSOCKETS_SERVER_PID_PATH
if websockets:
pid_file = WEBSOCKETS_SERVER_PID_PATH
def stop():
cwd = os.getcwd()
def stop():
cwd = os.getcwd()
- os.chdir(os.path.join(os.path.dirname(__file__), ARV_API_SERVER_DIR))
+ os.chdir(os.path.join(MY_DIRNAME, ARV_API_SERVER_DIR))
kill_server_pid(WEBSOCKETS_SERVER_PID_PATH, 0)
kill_server_pid(SERVER_PID_PATH, 0)
kill_server_pid(WEBSOCKETS_SERVER_PID_PATH, 0)
kill_server_pid(SERVER_PID_PATH, 0)
stop_keep()
cwd = os.getcwd()
stop_keep()
cwd = os.getcwd()
- os.chdir(os.path.join(os.path.dirname(__file__), KEEP_SERVER_DIR))
+ os.chdir(os.path.join(MY_DIRNAME, KEEP_SERVER_DIR))
if os.environ.get('GOPATH') == None:
os.environ["GOPATH"] = os.getcwd()
else:
if os.environ.get('GOPATH') == None:
os.environ["GOPATH"] = os.getcwd()
else:
def stop_keep():
cwd = os.getcwd()
def stop_keep():
cwd = os.getcwd()
- os.chdir(os.path.join(os.path.dirname(__file__), KEEP_SERVER_DIR))
+ os.chdir(os.path.join(MY_DIRNAME, KEEP_SERVER_DIR))
_stop_keep(0)
_stop_keep(1)
_stop_keep(0)
_stop_keep(1)
stop_keep_proxy()
cwd = os.getcwd()
stop_keep_proxy()
cwd = os.getcwd()
- os.chdir(os.path.join(os.path.dirname(__file__), KEEP_SERVER_DIR))
+ os.chdir(os.path.join(MY_DIRNAME, KEEP_SERVER_DIR))
if os.environ.get('GOPATH') == None:
os.environ["GOPATH"] = os.getcwd()
else:
if os.environ.get('GOPATH') == None:
os.environ["GOPATH"] = os.getcwd()
else:
def stop_keep_proxy():
cwd = os.getcwd()
def stop_keep_proxy():
cwd = os.getcwd()
- os.chdir(os.path.join(os.path.dirname(__file__), KEEP_SERVER_DIR))
+ os.chdir(os.path.join(MY_DIRNAME, KEEP_SERVER_DIR))
kill_server_pid("tmp/keepproxy.pid", 0)
os.chdir(cwd)
def fixture(fix):
'''load a fixture yaml file'''
kill_server_pid("tmp/keepproxy.pid", 0)
os.chdir(cwd)
def fixture(fix):
'''load a fixture yaml file'''
- with open(os.path.join(os.path.dirname(__file__), ARV_API_SERVER_DIR, "test", "fixtures",
+ with open(os.path.join(MY_DIRNAME, ARV_API_SERVER_DIR, "test", "fixtures",
fix + ".yml")) as f:
return yaml.load(f.read())
fix + ".yml")) as f:
return yaml.load(f.read())
func pythonDir() string {
gopath := os.Getenv("GOPATH")
func pythonDir() string {
gopath := os.Getenv("GOPATH")
- return fmt.Sprintf("%s/../../sdk/python", strings.Split(gopath, ":")[0])
+ return fmt.Sprintf("%s/../../sdk/python/tests", strings.Split(gopath, ":")[0])
}
func (s *ServerRequiredSuite) SetUpSuite(c *C) {
}
func (s *ServerRequiredSuite) SetUpSuite(c *C) {