-
Notifications
You must be signed in to change notification settings - Fork 40
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
test: Use fake profile data instead of test_usa_tamu #586
test: Use fake profile data instead of test_usa_tamu #586
Conversation
d1af535
to
e14f7ec
Compare
e14f7ec
to
5d306f8
Compare
This is nice! I'm wondering whether it is possible to pull |
@jon-hagg With the |
I would keep them for now - they are used here to test scenario preparation |
47e49fd
to
1cc34bc
Compare
Thanks for your suggestion @BainanXia! I reorganized the code as you suggested. Let me know what you think! |
Perhaps I can remove this dependency on |
Thanks for the contribution! I think we are good to go except for some minor concerns above. |
1cc34bc
to
098d9f3
Compare
Thanks! I addressed your comments. Let me know if you find anything else! |
MockInputData is a mock of powersimdata.input.input_data.InputData | ||
that generates random profiles. | ||
|
||
Exactly 3 of {`start_time`, `end_time`, `periods`, `freq`} must be specified. See <https://pandas.pydata.org/docs/reference/api/pandas.date_range.html>. |
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.
Nice!
@pytest.fixture(scope="module") | ||
def input_data(base_grid): | ||
mock_input_data = MockInputData(base_grid) | ||
return mock_input_data | ||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
def mock_input_data_class(input_data): | ||
with patch( | ||
"powersimdata.input.transform_profile.InputData" | ||
) as mock_input_data_class: | ||
mock_input_data_class.return_value = input_data | ||
yield |
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.
This is clean.
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.
Great! Thanks for improving test coverage and the patience @c-voegele
Thanks for the approval! It doesn't look like I have write permissions so this is as far as I can go. |
No worries, we will take care of it. |
Pull Request doc
Purpose
Hi Breakthrough Energy Team! Thank you for your work on this interesting and important project!
This PR is an attempt to fix #489.
The
test_usa_tamu
profiles are no longer needed fortest_transform_profile
and no Internet connection is required to run the tests.What the code is doing
To avoid the Azure blob call, I mocked
InputData
to return random profiles. I just used uniform random data in [0, 1) as suggested hereTesting
I ran
tox -e pytest-local -- --cov=powersimdata
andtox -e checkformatting
and both are passing.To make sure that
test_usa_tamu
was not required, I wiped~/ScenarioData
and rebuilt it withLocalConfig().initialize()
. After running the tests,test_usa_tamu
is no longer loaded.Where to look
powersimdata/input/tests/test_transform_grid.py
Usage Example/Visuals
n/a
Time estimate
15 minutes