Skip to content

Commit

Permalink
Change unittest to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
daklauss committed Dec 5, 2024
1 parent d97cf31 commit 3e7f58b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Test
run: |
python -m unittest discover -s tests
pytest tests -m "not slow"
- name: Install pypa/build
run: |
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand All @@ -54,7 +55,6 @@ docs = [
"sphinx_copybutton>=0.5.1",
"sphinx-sitemap>=2.5.0",
]

ax = [
"ax-platform >=0.3.5"
]
Expand All @@ -78,3 +78,9 @@ line-length = 88
testpaths = [
"tests",
]
pythonpath = [
"tests",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
]
6 changes: 3 additions & 3 deletions tests/test_optimizer_behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
):
Expand Down Expand Up @@ -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
):
Expand Down

0 comments on commit 3e7f58b

Please sign in to comment.