From eb7d45dbedce16843e9ba154b1143a76c32261f4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 21 Dec 2023 23:14:44 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../testers/haskell/haskell_tester.py | 35 ++++++++----------- .../autotest_server/testers/haskell/setup.py | 15 ++------ 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/server/autotest_server/testers/haskell/haskell_tester.py b/server/autotest_server/testers/haskell/haskell_tester.py index 773096be..572f2841 100644 --- a/server/autotest_server/testers/haskell/haskell_tester.py +++ b/server/autotest_server/testers/haskell/haskell_tester.py @@ -7,11 +7,8 @@ from ..tester import Tester, Test, TestError from ..specs import TestSpecs -STACK_OPTIONS = [ - '--resolver=lts-14.27', - '--system-ghc', - '--allow-different-user' -] +STACK_OPTIONS = ["--resolver=lts-14.27", "--system-ghc", "--allow-different-user"] + class HaskellTest(Test): def __init__( @@ -110,24 +107,22 @@ def run_haskell_tests(self) -> Dict[str, List[Dict[str, Union[int, str]]]]: for test_file in self.specs["test_data", "script_files"]: with tempfile.NamedTemporaryFile(dir=this_dir) as f: cmd = [ - "stack", - "exec", - *STACK_OPTIONS, - "--", - "tasty-discover", - ".", - "_", - f.name, - *self._test_run_flags(test_file) + "stack", + "exec", + *STACK_OPTIONS, + "--", + "tasty-discover", + ".", + "_", + f.name, + *self._test_run_flags(test_file), ] subprocess.run(cmd, stdout=subprocess.DEVNULL, universal_newlines=True, check=True) with tempfile.NamedTemporaryFile(mode="w+", dir=this_dir) as sf: - cmd = ["stack", "runghc", - *STACK_OPTIONS, - "--", - f"-i={haskell_lib}", f.name, f"--stats={sf.name}"] - subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True, - check=True) + cmd = ["stack", "runghc", *STACK_OPTIONS, "--", f"-i={haskell_lib}", f.name, f"--stats={sf.name}"] + subprocess.run( + cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True, check=True + ) results[test_file] = self._parse_test_results(csv.reader(sf)) return results diff --git a/server/autotest_server/testers/haskell/setup.py b/server/autotest_server/testers/haskell/setup.py index ff52f341..2cbcdb65 100644 --- a/server/autotest_server/testers/haskell/setup.py +++ b/server/autotest_server/testers/haskell/setup.py @@ -3,21 +3,12 @@ import subprocess -HASKELL_TEST_DEPS = [ - "tasty-discover", - "tasty-quickcheck" -] +HASKELL_TEST_DEPS = ["tasty-discover", "tasty-quickcheck"] + def create_environment(_settings, _env_dir, default_env_dir): resolver = "lts-14.27" - cmd = [ - "stack", - "build", - "--resolver", - resolver, - "--system-ghc", - *HASKELL_TEST_DEPS - ] + cmd = ["stack", "build", "--resolver", resolver, "--system-ghc", *HASKELL_TEST_DEPS] subprocess.run(cmd, check=True) return {"PYTHON": os.path.join(default_env_dir, "bin", "python3")}