chore: consistent pytest fixture naming #228

Merged
synchon merged 4 commits from chore/pytest-fixture-naming into main 2023-06-20 10:28:17 +00:00
4 changed files with 30 additions and 29 deletions

View file

@ -0,0 +1 @@
Consistent docstrings for pytest fixtures used in the test suite by `Synchon Mandal`_

View file

@ -246,9 +246,9 @@ def test_queue_correct_yaml_config(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
""" """
with monkeypatch.context() as m: with monkeypatch.context() as m:
@ -305,7 +305,7 @@ def test_queue_invalid_job_queue(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
""" """
with pytest.raises(ValueError, match="Unknown queue kind"): with pytest.raises(ValueError, match="Unknown queue kind"):
@ -328,7 +328,7 @@ def test_queue_assets_disallow_overwrite(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
""" """
with pytest.raises(ValueError, match="Either delete the directory"): with pytest.raises(ValueError, match="Either delete the directory"):
@ -360,9 +360,9 @@ def test_queue_assets_allow_overwrite(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
""" """
with monkeypatch.context() as m: with monkeypatch.context() as m:
@ -405,9 +405,9 @@ def test_queue_with_imports(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
with_ : str or list of str with_ : str or list of str
The parametrized imports. The parametrized imports.
@ -456,9 +456,9 @@ def test_queue_with_elements(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
elements : str of list of str elements : str of list of str
The parametrized elements for the queue. The parametrized elements for the queue.
@ -486,9 +486,9 @@ def test_queue_without_elements(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
""" """
with monkeypatch.context() as m: with monkeypatch.context() as m:
@ -512,7 +512,7 @@ def test_queue_condor_invalid_python_env(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
""" """
with pytest.raises(ValueError, match="Unknown env kind"): with pytest.raises(ValueError, match="Unknown env kind"):
@ -537,9 +537,9 @@ def test_queue_condor_conda_python(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
""" """
with monkeypatch.context() as m: with monkeypatch.context() as m:
@ -571,9 +571,9 @@ def test_queue_condor_conda_pre_run_python(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
""" """
with monkeypatch.context() as m: with monkeypatch.context() as m:
@ -613,9 +613,9 @@ def test_queue_condor_venv_python(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
""" """
with monkeypatch.context() as m: with monkeypatch.context() as m:
@ -677,9 +677,9 @@ def test_queue_condor_assets_generation(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
elements : str elements : str
The parametrized element names. The parametrized element names.
env : dict env : dict
@ -794,7 +794,7 @@ def test_queue_condor_extra_preamble(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
""" """
jobname = "condor_extra_preamble_check" jobname = "condor_extra_preamble_check"
@ -839,9 +839,9 @@ def test_queue_condor_submission_fail(
tmp_path : pathlib.Path tmp_path : pathlib.Path
The path to the test directory. The path to the test directory.
monkeypatch : pytest.MonkeyPatch monkeypatch : pytest.MonkeyPatch
The monkeypatch object. The pytest.MonkeyPatch object.
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
The logcapturefixture object. The pytest.LogCaptureFixture object.
""" """
with pytest.raises( with pytest.raises(

View file

@ -42,7 +42,7 @@ def test_register(
Parameters Parameters
---------- ----------
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
A pytest fixture to capture logging. The pytest.LogCaptureFixture object.
step : str step : str
The parametrized name of the step. The parametrized name of the step.
name : str name : str

View file

@ -33,7 +33,7 @@ def test_log_versions(caplog: pytest.LogCaptureFixture) -> None:
Parameters Parameters
---------- ----------
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
A pytest fixture to capture logging. The pytest.LogCaptureFixture object.
""" """
# Set log capturing at INFO # Set log capturing at INFO
@ -161,7 +161,7 @@ def test_log_stdout(caplog: pytest.LogCaptureFixture) -> None:
Parameters Parameters
---------- ----------
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
A pytest fixture to capture logging. The pytest.LogCaptureFixture object.
""" """
configure_logging() configure_logging()
@ -197,7 +197,7 @@ def test_raise_error(caplog: pytest.LogCaptureFixture) -> None:
Parameters Parameters
---------- ----------
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
A pytest fixture to capture logging. The pytest.LogCaptureFixture object.
""" """
with pytest.raises(ValueError, match="test error"): with pytest.raises(ValueError, match="test error"):
@ -212,7 +212,7 @@ def test_warn_with_log(caplog: pytest.LogCaptureFixture) -> None:
Parameters Parameters
---------- ----------
caplog : pytest.LogCaptureFixture caplog : pytest.LogCaptureFixture
A pytest fixture to capture logging. The pytest.LogCaptureFixture object.
""" """
with pytest.warns(RuntimeWarning, match="test warning"): with pytest.warns(RuntimeWarning, match="test warning"):