diff --git a/Makefile b/Makefile index 8e49539..0f13f91 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ formatting: codestyle #* Linting .PHONY: test test: - PYTHONPATH=$(PYTHONPATH) poetry run pytest -c pyproject.toml --cov-report=html --cov=fake_vcf tests/ + PYTHONPATH=$(PYTHONPATH) poetry run pytest -n auto -c pyproject.toml --cov-report=html --cov=fake_vcf tests/ poetry run coverage-badge -o assets/images/coverage.svg -f .PHONY: check-codestyle diff --git a/poetry.lock b/poetry.lock index 4e51ab7..00eea53 100644 --- a/poetry.lock +++ b/poetry.lock @@ -375,6 +375,20 @@ files = [ [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "execnet" +version = "2.0.2" +description = "execnet: rapid multi-Python deployment" +optional = false +python-versions = ">=3.7" +files = [ + {file = "execnet-2.0.2-py3-none-any.whl", hash = "sha256:88256416ae766bc9e8895c76a87928c0012183da3cc4fc18016e6f050e025f41"}, + {file = "execnet-2.0.2.tar.gz", hash = "sha256:cc59bc4423742fd71ad227122eb0dd44db51efb3dc4095b45ac9a08c770096af"}, +] + +[package.extras] +testing = ["hatch", "pre-commit", "pytest", "tox"] + [[package]] name = "filelock" version = "3.13.1" @@ -921,6 +935,26 @@ pytest = ">=7.0.0" [package.extras] test = ["black (>=22.1.0)", "flake8 (>=4.0.1)", "pre-commit (>=2.17.0)", "tox (>=3.24.5)"] +[[package]] +name = "pytest-xdist" +version = "3.4.0" +description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-xdist-3.4.0.tar.gz", hash = "sha256:3a94a931dd9e268e0b871a877d09fe2efb6175c2c23d60d56a6001359002b832"}, + {file = "pytest_xdist-3.4.0-py3-none-any.whl", hash = "sha256:e513118bf787677a427e025606f55e95937565e06dfaac8d87f55301e57ae607"}, +] + +[package.dependencies] +execnet = ">=1.1" +pytest = ">=6.2.0" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + [[package]] name = "pyupgrade" version = "3.15.0" @@ -1224,13 +1258,13 @@ files = [ [[package]] name = "tomlkit" -version = "0.12.2" +version = "0.12.3" description = "Style preserving TOML library" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.12.2-py3-none-any.whl", hash = "sha256:eeea7ac7563faeab0a1ed8fe12c2e5a51c61f933f2502f7e9db0241a65163ad0"}, - {file = "tomlkit-0.12.2.tar.gz", hash = "sha256:df32fab589a81f0d7dc525a4267b6d7a64ee99619cbd1eeb0fae32c1dd426977"}, + {file = "tomlkit-0.12.3-py3-none-any.whl", hash = "sha256:b0a645a9156dc7cb5d3a1f0d4bab66db287fcb8e0430bdd4664a095ea16414ba"}, + {file = "tomlkit-0.12.3.tar.gz", hash = "sha256:75baf5012d06501f07bee5bf8e801b9f343e7aac5a92581f20f80ce632e6b5a4"}, ] [[package]] @@ -1327,4 +1361,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [metadata] lock-version = "2.0" python-versions = "^3.8.1" -content-hash = "bf3818a93d158c0cee2f783f617d24c182f9ed18cd2ca5c60d8ee6365bf46f0e" +content-hash = "7d373a74a0cb11b5cd469693c16edb034c5147bad460518f47d0e4a3cebd0c29" diff --git a/pyproject.toml b/pyproject.toml index f41f924..15ff327 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,7 @@ pytest-html = "^4.1.1" pytest-cov = "^4.1.0" black = {version = "^23.11.0", allow-prereleases = true} safety = "^2.3.5" +pytest-xdist = "^3.4.0" [tool.black] # https://github.com/psf/black diff --git a/tests/test_example/test_vcf_validator.py b/tests/test_example/test_vcf_validator.py index f1c49e0..7e09a0e 100644 --- a/tests/test_example/test_vcf_validator.py +++ b/tests/test_example/test_vcf_validator.py @@ -1,3 +1,4 @@ +import itertools import platform import stat import subprocess @@ -52,17 +53,30 @@ def run_vcf_validator(vcf_file_path, result_path): @pytest.mark.parametrize( - ("cli_args",), - [ - (["-r", "10", "--no-large-format"],), - (["-r", "50", "--no-large-format"],), - (["-r", "100", "--no-large-format"],), - (["-r", "10", "--large-format"],), - ], + "cli_args", + list( + itertools.product( + *[ + [["-r", f"{r}"] for r in range(1, 100, 25)], + [["-s", f"{s}"] for s in range(1, 100, 25)], + ["--large-format", "--no-large-format"], + ["--phased", "--no-phased"], + [[f"-c", f"chr{c}"] for c in range(1, 23)], + ] + ) + ), ) -def test_vcf_file_validation(cli_args: list, tmp_path): +def test_vcf_file_validation(cli_args: tuple, tmp_path): vcf_file_path = tmp_path / "example.vcf" - args = cli_args + ["-o", vcf_file_path] + args = [] + for cli_arg in cli_args: + if type(cli_arg) is list: + args += cli_arg + else: + args += [cli_arg] + + args += ["-o", vcf_file_path] + runner.invoke(app, args=args) validator_status, validation_result = run_vcf_validator(