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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fkiraly
added
module:tests
test framework functionality - only framework, excl specific tests
enhancement
Adding new functionality
labels
Apr 9, 2024
fkiraly
requested review from
achieveordie,
benHeid and
yarnabrina
as code owners
April 9, 2024 08:50
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`.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.