diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 4cc51ecd..2b1f5b24 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -68,7 +68,7 @@ jobs: - name: Test run: | - python -m unittest discover -s tests + pytest tests -m "not slow" - name: Install pypa/build run: | diff --git a/pyproject.toml b/pyproject.toml index eab50479..d11219fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ dependencies = [ testing = [ "certifi", # tries to prevent certificate problems on windows "pytest", + "coverage", "pre-commit", # system tests run pre-commit "ax-platform >=0.3.5" ] @@ -54,7 +55,6 @@ docs = [ "sphinx_copybutton>=0.5.1", "sphinx-sitemap>=2.5.0", ] - ax = [ "ax-platform >=0.3.5" ] @@ -78,3 +78,9 @@ line-length = 88 testpaths = [ "tests", ] +pythonpath = [ + "tests", +] +markers = [ + "slow: marks tests as slow (deselect with '-m \"not slow\"')", +] diff --git a/tests/test_optimizer_behavior.py b/tests/test_optimizer_behavior.py index acd54301..b0af2265 100644 --- a/tests/test_optimizer_behavior.py +++ b/tests/test_optimizer_behavior.py @@ -178,7 +178,7 @@ def optimizer(request): # %% Tests - +@pytest.mark.slow def test_convergence(optimization_problem: TestProblem, optimizer: OptimizerBase): # only test problems that the optimizer can handle. The rest of the tests # will be marked as passed @@ -194,7 +194,7 @@ def test_convergence(optimization_problem: TestProblem, optimizer: OptimizerBase else: optimization_problem.test_if_solved(results, MOO_TEST_KWARGS) - +@pytest.mark.slow def test_from_initial_values( optimization_problem: TestProblem, optimizer: OptimizerBase ): @@ -233,7 +233,7 @@ def __call__(self, results): raise RuntimeError("Max number of evaluations reached. Aborting!") self.n_calls += 1 - +@pytest.mark.slow def test_resume_from_checkpoint( optimization_problem: TestProblem, optimizer: OptimizerBase ):