Skip to content

Commit

Permalink
clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danrgll committed Nov 27, 2023
1 parent 2ac8118 commit 5096129
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:

- name: Run pytest
timeout-minutes: 15
run: poetry run pytest -m "all_examples or metahyper or summary_csv"
run: poetry run pytest -m "all_examples or metahyper or summary_csv or yaml_api"
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ profile = 'black'
line_length = 90

[tool.pytest.ini_options]
addopts = "--basetemp ./tests_tmpdir -m 'core_examples or yaml_api or yaml_search_space'"
markers = ["all_examples", "core_examples", "regression_all", "metahyper", "yaml_api", "summary_csv",
"yaml_search_space"]
addopts = "--basetemp ./tests_tmpdir -m 'core_examples or yaml_api'"
markers = ["all_examples", "core_examples", "regression_all", "metahyper", "yaml_api", "summary_csv"]
filterwarnings = "ignore::DeprecationWarning:torch.utils.tensorboard.*:"

[tool.mypy]
Expand Down
10 changes: 5 additions & 5 deletions tests/test_yaml_search_space/test_search_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from neps.search_spaces.search_space import pipeline_space_from_yaml


@pytest.mark.yaml_search_space
@pytest.mark.yaml_api
def test_correct_yaml_file():
"""Test the function with a correctly formatted YAML file."""
pipeline_space = pipeline_space_from_yaml(
Expand Down Expand Up @@ -35,7 +35,7 @@ def test_correct_yaml_file():
assert pipeline_space["dropout_rate"].is_fidelity is False


@pytest.mark.yaml_search_space
@pytest.mark.yaml_api
def test_correct_including_priors_yaml_file():
"""Test the function with a correctly formatted YAML file."""
pipeline_space = pipeline_space_from_yaml(
Expand Down Expand Up @@ -66,21 +66,21 @@ def test_correct_including_priors_yaml_file():
assert pipeline_space["dropout_rate"].is_fidelity is True


@pytest.mark.yaml_search_space
@pytest.mark.yaml_api
def test_incorrect_yaml_file():
"""Test the function with an incorrectly formatted YAML file."""
with pytest.raises(ValueError):
pipeline_space_from_yaml("tests/test_yaml_search_space/incorrect_config.txt")


@pytest.mark.yaml_search_space
@pytest.mark.yaml_api
def test_yaml_file_with_missing_key():
"""Test the function with a YAML file missing a required key."""
with pytest.raises(KeyError):
pipeline_space_from_yaml("tests/test_yaml_search_space/missing_key_config.yml")


@pytest.mark.yaml_search_space
@pytest.mark.yaml_api
def test_yaml_file_with_inconsistent_types():
"""Test the function with a YAML file having inconsistent types for
'lower' and 'upper'."""
Expand Down

0 comments on commit 5096129

Please sign in to comment.