Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 21, 2023
1 parent 8babffd commit eb7d45d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 32 deletions.
35 changes: 15 additions & 20 deletions server/autotest_server/testers/haskell/haskell_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down Expand Up @@ -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

Expand Down
15 changes: 3 additions & 12 deletions server/autotest_server/testers/haskell/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")}
Expand Down

0 comments on commit eb7d45d

Please sign in to comment.