diff --git a/pyproject.toml b/pyproject.toml index baef9da..36641fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,7 +78,7 @@ test-groups = ["dev"] test-command = [ "python -c 'import mwparserfromhell.parser._tokenizer'", "pytest {project}/tests -rxs --cov=mwparserfromhell", - "if [[ $RUNNER_OS == Linux ]]; then mkdir -p /output && mv .coverage /output/.coverage.$(uuidgen); fi" + "python {project}/scripts/save_coverage.py", ] [tool.pyright] diff --git a/scripts/save_coverage.py b/scripts/save_coverage.py new file mode 100755 index 0000000..566c73d --- /dev/null +++ b/scripts/save_coverage.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import os +import shutil +import traceback +import uuid + +try: + if os.getenv("RUNNER_OS") == "Linux": + os.makedirs("/output", exist_ok=True) + shutil.move(".coverage", f"/output/.coverage.{uuid.uuid4().hex}") +except Exception: + traceback.print_exc()