From d4fd9687653f0cdd5808d1338dc92bdb9bf9ce46 Mon Sep 17 00:00:00 2001 From: Zixian Cai <2891235+caizixian@users.noreply.github.com> Date: Sat, 6 Jan 2024 12:07:51 +1100 Subject: [PATCH] Fix circular import when running tests individually (#138) --- .github/workflows/python.yml | 2 +- src/running/benchmark.py | 3 ++- src/running/suite.py | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 23faaac..01ff450 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -21,7 +21,7 @@ jobs: pip install .[tests] - name: Test with pytest run: | - pytest + for f in tests/test_*.py; do pytest "$f"; done mypy: runs-on: ubuntu-latest strategy: diff --git a/src/running/benchmark.py b/src/running/benchmark.py index 5cec9ce..642dd96 100644 --- a/src/running/benchmark.py +++ b/src/running/benchmark.py @@ -8,7 +8,6 @@ from running.util import smart_quote, split_quoted from pathlib import Path from copy import deepcopy -from running import suite import os from enum import Enum @@ -111,6 +110,8 @@ def to_string(self, runtime: Runtime) -> str: def run( self, runtime: Runtime, cwd: Optional[Path] = None ) -> Tuple[bytes, bytes, SubprocessrExit]: + from running import suite + if suite.is_dry_run(): print(self.to_string(runtime), file=sys.stderr) return b"", b"", SubprocessrExit.Dryrun diff --git a/src/running/suite.py b/src/running/suite.py index b53aee3..cdf6781 100644 --- a/src/running/suite.py +++ b/src/running/suite.py @@ -1,5 +1,5 @@ from pathlib import Path -from typing import Any, Dict, Optional, Union, List, Sequence +from typing import Any, Dict, Optional, Union from running.benchmark import ( JavaBenchmark, BinaryBenchmark, @@ -7,8 +7,6 @@ JavaScriptBenchmark, JuliaBenchmark, ) -from running.runtime import OpenJDK, Runtime -from running.modifier import JVMArg, Modifier import logging from running.util import register, split_quoted import os.path