run mine with market test standalone

This commit is contained in:
boqiu 2024-09-05 15:42:55 +08:00
parent 7ef1a73c7c
commit ec21c6fce4
2 changed files with 16 additions and 3 deletions

View File

@ -7,6 +7,7 @@ from utility.run_all import run_all
if __name__ == "__main__":
run_all(
test_dir = os.path.dirname(__file__),
slow_tests={"random_test.py", "same_root_test.py"},
slow_tests={"mine_test.py", "random_test.py", "same_root_test.py"},
long_manual_tests={"fuzz_test.py"},
single_run_tests={"mine_with_market_test.py"},
)

View File

@ -58,7 +58,7 @@ def run_single_test(py, script, test_dir, index, port_min, port_max):
raise err
print_testcase_result(BLUE, TICK, script, start_time)
def run_all(test_dir: str, test_subdirs: list[str]=[], slow_tests: set[str]={}, long_manual_tests: set[str]={}):
def run_all(test_dir: str, test_subdirs: list[str]=[], slow_tests: set[str]={}, long_manual_tests: set[str]={}, single_run_tests: set[str]={}):
tmp_dir = os.path.join(test_dir, "tmp")
if not os.path.exists(tmp_dir):
os.makedirs(tmp_dir, exist_ok=True)
@ -102,7 +102,7 @@ def run_all(test_dir: str, test_subdirs: list[str]=[], slow_tests: set[str]={},
for file in os.listdir(subdir_path):
if file.endswith("_test.py"):
rel_path = os.path.join(subdir, file)
if rel_path not in slow_tests and rel_path not in long_manual_tests:
if rel_path not in slow_tests and rel_path not in long_manual_tests and rel_path not in single_run_tests:
TEST_SCRIPTS.append(rel_path)
executor = ProcessPoolExecutor(max_workers=options.max_workers)
@ -135,6 +135,18 @@ def run_all(test_dir: str, test_subdirs: list[str]=[], slow_tests: set[str]={},
print("CalledProcessError " + repr(err))
failed.add(script)
# Run single tests one by one
for script in single_run_tests:
f = executor.submit(
run_single_test, py, script, test_dir, i, options.port_min, options.port_max
)
try:
f.result()
except subprocess.CalledProcessError as err:
print("CalledProcessError " + repr(err))
failed.add(script)
i += 1
print("Elapsed: " + str(int(time.time() - start_time)) + " seconds", flush=True)
if len(failed) > 0: