Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] refactor test scenario creation to be lazy rather than on module load #6278

Merged
merged 19 commits into from Apr 12, 2024

Conversation

fkiraly
Copy link
Collaborator

@fkiraly fkiraly commented Apr 9, 2024

This PR refactors test scenario creation to be lazy rather than on module load.

Currently, the data for test scenarios is created on module load and is persisted as module variables, which may increase test collection time and memory usage. The status quo also creates a risk for side effects to which pandas objects are prone.

This PR migrates the architecture to the same pattern that pytest fixtures use, where concrete objects are only created when the scenario is loaded. The change also ensures that a new object is created each time the fixture is requested, avoiding side effects from mutating the single reference.

@fkiraly fkiraly added module:tests test framework functionality - only framework, excl specific tests enhancement Adding new functionality labels Apr 9, 2024
fkiraly added a commit to sktime/skpro that referenced this pull request Apr 10, 2024
…e load (#245)

This PR refactors test scenario creation to be lazy rather than on
module load.

Currently, the data for test scenarios is created on module load and is
persisted as module variables, which may increase test collection time
and memory usage. The status quo also creates a risk for side effects to
which `pandas` objects are prone.

This PR migrates the architecture to the same pattern that `pytest`
fixtures use, where concrete objects are only created when the scenario
is loaded. The change also ensures that a new object is created each
time the fixture is requested, avoiding side effects from mutating the
single reference.

Same as sktime/sktime#6278, for `skpro`.
@fkiraly fkiraly merged commit 34c37f7 into main Apr 12, 2024
53 checks passed
@fkiraly fkiraly deleted the refactor-scenarios-lazy branch April 12, 2024 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding new functionality module:tests test framework functionality - only framework, excl specific tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant