Restructure test files and extend usage of (corrected) pytest fixtures
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5
- Forks
- 3
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 8
Description
In #18 / #227 a series of `@pytest.fixture` were created in `test_update_recipe_file.py`.
These should be moved to a new `conftest.py` file for reuse per the new [wiki: Testing requirements](https://github.com/MetOffice/CMEW/wiki/Developer-Guide#testing-requirements).
Fixture reuse should be possible in `test_create_request_file.py`.
The fixture `env-var` perhaps also be expanded as a single source of truth for mocking environment variables.
Comment from #227 from @ehogan:
> If you decide to move these tests as per the newly created and discussed [wiki: Testing requirements](https://github.com/MetOffice/CMEW/wiki/Developer-Guide#testing-requirements), these fixtures could be added to a [conftest.py](https://docs.pytest.org/en/7.1.x/reference/fixtures.html#conftest-py-sharing-fixtures-across-multiple-files) file in the app/unittest/tests/ directory! :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the fixtures in test_update_recipe_file.py and the related tests in test_create_request_file.py, then review the Testing requirements guidance and pytest's conftest.py fixture rules. Move reusable fixtures into conftest.py under app/unittest/tests/ and verify both test files reuse them. Confirm that env-var provides the intended single source for mocked environment variables and that the affected tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100