-
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: include transform profile tests by default #485
Conversation
This is nice. Just curious is it possible to mock a short profile based on the given grid model instead of downloading truncated profiles from blob storage? |
Interesting idea, I don't see why not. I think the only requirement is that the plant ids match. It would just be a bit more code to generate the mock profile, and save the csv to the expected location. I originally had the truncated profiles checked into git, but opted for the approach here since it doesn't bypass any functionality or involve any monkeypatching. |
It would be great that these tests can run successfully even without internet connection;) Previously, we load real profiles for these tests for the same reason as you mentioned, i.e. that's the most light way (from developer's perspective) to increase the test coverage. As for now, I could see this in two options, a) still load a real grid but mock profiles based on the information of the loaded grid b) mock everything, i.e. starting with a mock grid, then mock profiles accordingly. I presume the second approach is still tricky for now, since we did add lots of new features to the grid which makes it hard to mock. Hence, the first track could be way to proceed I would say. |
1a1d3f0
to
3edfb58
Compare
Not sure what can be done. The |
One thing to note is that profiles are cached locally, so we would only need an internet connection the first time (though I agree it's better not to require at all). It would be possible to mock the profiles based on the grid, and save them to |
I agree. There is decent amount of work to getting those profile related tests work with mocks which currently rely on real profiles at this point. But the benefits are obvious:
|
One final comment I have is that it is complicated to tests the methods of the |
It should work if the mock profiles have consistent rows/columns with the same relationship defined in the grid model constants, right? Or we could even have a mock grid model which can be loaded by |
Yeah I was imagining we would just create a time series data frame with the plant ids from the grid (matching the resource type) as columns, and put random values from |
Once we have the mock architecture ready, we could fill it with whatever values are we want as long as it passes basic sanity checks in our code, such as values should be greater than zero etc. |
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.
Thanks for improving our test coverage!
3edfb58
to
67a3845
Compare
Purpose
The transform profile tests don't require the server, but if we run them in CI it would require downloading from blob storage each time, which would significantly increase the wait time and bandwidth required. I uploaded some truncated profiles (just using rows for Jan 1) to blob storage, under a new
test_usa_tamu
grid model which we can use in the tests with minimal changes.What the code is doing
Refactor the profile fixtures, point to the new test grid model, add a couple missing pytest markers.
Testing
Ran locally and checked the profiles are downloaded to
~/ScenarioData/raw/test_usa_tamu
.Time estimate
10 min