Skip to content

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Mar 30, 2025

Description

As the Config class contains a number of static properties, it is important to avoid tests influencing each other if the tests would cause changes to the value of the static properties.

This was already handled correctly in the two places were the real Config class is being used in the tests, but that meant those test classes now contain duplicate code.

This new AbstractRealConfigTestCase class removes that code duplication.

This test case should be used in the rare circumstances that the real Config class needs to be used in the tests.

In most cases, using the ConfigDouble class is much preferred, but for select tests for the Config class itself + for tests involving the Runner class, using the real Config class cannot be avoided.

Suggested changelog entry

N/A

As the `Config` class contains a number of `static` properties, it is important to avoid tests influencing each other if the tests would cause changes to the value of the static properties.

This was already handled correctly in the two places were the _real_ `Config` class is being used in the tests, but that meant those test classes now contain duplicate code.

This new `AbstractRealConfigTestCase` class removes that code duplication.

This test case should be used in the rare circumstances that the _real_ `Config` class needs to be used in the tests.

In most cases, using the `ConfigDouble` class is much preferred, but for select tests for the `Config` class itself + for tests involving the `Runner` class, using the real `Config` class cannot be avoided.
@jrfnl jrfnl force-pushed the feature/tests-add-abstract-real-config-testcase branch from 7a72e88 to c157dc4 Compare March 30, 2025 17:26
@jrfnl jrfnl merged commit 360e30a into master Mar 30, 2025
90 of 95 checks passed
@jrfnl jrfnl deleted the feature/tests-add-abstract-real-config-testcase branch March 30, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant