MetOffice / MetOffice/CMEW

Refactor functions to avoid patching/monkeypatching environment variables when testing.

Open
#238 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

configure enhancement quality assurance technical debt testing
Dominant language
Python
Stars
5
Forks
3
Avg merge
5d 6h
Merged PRs (30d)
8

Description

The code in configure_process/configure_process.py has been rewritten to be more testable and avoid the need to patch/monkeypatch environment variables.

The tests in configure_for/update_recipe.py and configure_standardise/create_request_file.py should be refactored to follow this logic.

The accompanying tests should then be similarly refactored so all uses of monkeypatch.setenv can be removed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the rewritten configure_process.py logic with the tests in update_recipe.py and create_request_file.py. Refactor those tests to use the new logic without patching environment variables, then update the accompanying tests so all monkeypatch.setenv uses are removed and the tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.