-
Notifications
You must be signed in to change notification settings - Fork 250
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
Unit test base network #1438
Merged
Merged
Unit test base network #1438
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
046fd3a
code: add unit tests for base_network.py
finozzifa 8169205
Merge branch 'master' of https://github.com/PyPSA/pypsa-eur into unit…
finozzifa b7cc742
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e618ec6
code: pre-commit checks
finozzifa b505fd1
Merge branch 'unit_test_base_network' of https://github.com/finozzifa…
finozzifa f7b5a84
code: add further unit tests base_network
finozzifa 2371cc3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] edb4ecb
code: new test
finozzifa 6a1538c
Merge branch 'unit_test_base_network' of https://github.com/finozzifa…
finozzifa 1a5e08b
Merge branch 'master' of https://github.com/PyPSA/pypsa-eur into unit…
finozzifa dff048b
code: add unit test for _load_buses and sketch the one for _load_conv…
finozzifa df9d774
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 4111708
code: pre-commit
finozzifa 244b7bd
Merge branch 'unit_test_base_network' of https://github.com/finozzifa…
finozzifa 2dc6b9a
code: fix issue with test_load_buses
finozzifa bdcffae
code: unit test for _load_converters_from_osm
finozzifa 151214a
data: add italy_shape.geojson
finozzifa a943f53
code: unit test for _load_converters_from_eg and _load_transformers
finozzifa 429fee8
code: add unit test for _load_links_from_osm and _load_links_from_eg
finozzifa 2f4ec22
code: add unit test for _load_lines
finozzifa b9104f4
Merge branch 'master' of https://github.com/PyPSA/pypsa-eur into unit…
finozzifa 37da69a
code: add unit test for _reconnect_crimea
finozzifa a3df7e4
code: add unit test for _set_electrical_parameters_lines_eg
finozzifa 3d1b67e
code: add new unit tests
finozzifa 14ad7ba
Merge branch 'master' of https://github.com/PyPSA/pypsa-eur into unit…
finozzifa ea5a9a6
code: fixing unlink usage
finozzifa b85dbff
code: config fixture - scope from function to session
finozzifa 4265e29
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any best practices for choosing scopes? I think the
function
scope works well for DataFrames because they initialise quickly. But in PyPSA I've been playing around with the scope of test networks because they are sometimes modified and sometimes not in the tests, which adds up iffunction
is used as scope.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And same goes for the two network fixtures you created here already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @lkstrp,
indeed great question!
I usually used function being the default one and (most likely) the safest one.
However, now that I think about it, the
config
fixture can be initialized only once per test session. Changing the scope for this fixture actually leads to a speed up of the test execution (almost 30%). You can find the results below. The scope session and package behave equally well.This is of course not very relevant now, but it will become once we add more and more tests.