From a5038aacdd83a03fc260e822b099f176e4bc1772 Mon Sep 17 00:00:00 2001 From: EtayLivne Date: Thu, 24 Oct 2024 11:08:16 +0300 Subject: [PATCH 1/2] added pytest-xdist dependency and automatic use of -n auto --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a15686a..87905fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers = [ dependencies = ["torch>=2.0.0", "torchopt>=0.7.3", "optree>=0.10.0"] [project.optional-dependencies] -test = ["pre-commit", "pytest-cov", "ruff"] +test = ["pre-commit", "pytest-cov", "pytest-xdist", "ruff"] docs = ["mkdocs", "mkdocs-material", "mkdocstrings[python]"] [tool.setuptools] @@ -33,6 +33,9 @@ packages = [ [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "F821", "E402"] +[tool.pytest.ini_options] +addopts = "-n auto" + [build-system] requires = ["setuptools>=64"] build-backend = "setuptools.build_meta" \ No newline at end of file From a07d166db686ae9b5aa945f4b13fdc61638a195e Mon Sep 17 00:00:00 2001 From: EtayLivne Date: Sat, 26 Oct 2024 15:03:41 +0300 Subject: [PATCH 2/2] disabled automatic multithreading in local tests, and enabled it when running github tests action --- .github/workflows/tests.yaml | 2 +- pyproject.toml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 85e8d4a..304f107 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -36,4 +36,4 @@ jobs: pip install '.[test]' - name: Run the tests with pytest run: | - python -m pytest --cov=posteriors --cov-report term-missing \ No newline at end of file + python -m pytest -n auto --cov=posteriors --cov-report term-missing \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 87905fb..eda2786 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,6 @@ packages = [ [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "F821", "E402"] -[tool.pytest.ini_options] -addopts = "-n auto" [build-system] requires = ["setuptools>=64"]