2020-04-02 16:28:44 +00:00
|
|
|
import os
|
|
|
|
|
2020-04-22 00:33:10 +00:00
|
|
|
import numpy as np
|
|
|
|
|
2020-04-02 16:28:44 +00:00
|
|
|
TEST_ROOT = os.path.dirname(__file__)
|
2020-12-02 10:00:05 +00:00
|
|
|
PROJECT_ROOT = os.path.dirname(TEST_ROOT)
|
|
|
|
TEMP_PATH = os.path.join(PROJECT_ROOT, 'test_temp')
|
|
|
|
|
2020-12-07 09:31:33 +00:00
|
|
|
# todo: this setting `PYTHONPATH` may not be used by other evns like Conda for import packages
|
2020-12-02 10:00:05 +00:00
|
|
|
if PROJECT_ROOT not in os.getenv('PYTHONPATH', ""):
|
2020-12-07 09:31:33 +00:00
|
|
|
splitter = ":" if os.environ.get("PYTHONPATH", "") else ""
|
|
|
|
os.environ['PYTHONPATH'] = f'{PROJECT_ROOT}{splitter}{os.environ.get("PYTHONPATH", "")}'
|
2020-04-22 00:33:10 +00:00
|
|
|
|
|
|
|
# generate a list of random seeds for each test
|
|
|
|
RANDOM_PORTS = list(np.random.randint(12000, 19000, 1000))
|
|
|
|
|
|
|
|
if not os.path.isdir(TEMP_PATH):
|
|
|
|
os.mkdir(TEMP_PATH)
|