ModellingWebLab / WebLab

Django-based front-end for the modelling Web Lab v2
Other
3 stars 2 forks source link

yield_fixture (in tests) is deprecated #381

Open MichaelClerx opened 2 years ago

MichaelClerx commented 2 years ago

From the test (build) output:

weblab/conftest.py:516
  /home/runner/work/WebLab/WebLab/weblab/conftest.py:516: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
  Use @pytest.fixture instead; they are the same.
    def mock_column_names():

weblab/conftest.py:523
  /home/runner/work/WebLab/WebLab/weblab/conftest.py:523: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
  Use @pytest.fixture instead; they are the same.
    def story(logged_in_user, experiment_with_result):

weblab/experiments/tests/test_views.py:59
  /home/runner/work/WebLab/WebLab/weblab/experiments/tests/test_views.py:59: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
  Use @pytest.fixture instead; they are the same.
    def archive_file(archive_file_path):

-- Docs: https://docs.pytest.org/en/stable/warnings.html
MichaelClerx commented 2 years ago

https://docs.pytest.org/en/latest/yieldfixture.html

Since pytest-3.0, fixtures using the normal fixture decorator can use a yield statement to provide fixture values and execute teardown code, exactly like yield_fixture in previous versions.

Marking functions as yield_fixture is still supported, but deprecated and should not be used in new code.

We currently have pytest<7 in dev.in (why? surely test software can't have version conflicts?), so would have to amend that to pytest>=3,<7

MichaelClerx commented 2 years ago

Seems like an rc for 7 is on pip as a pre-release. Strange that we've needed to exclude that then, wonder if there's a way to make it ignore that without hardcoding the version no