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

tests(parsers, ESTADISTICO_UT): add snapshot test for historical prod #7742

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

consideRatio
Copy link
Contributor

@consideRatio consideRatio commented Jan 14, 2025

Issue

Ping @PaulRoms and @VIKTORVAV99 - this follows up on #7739 (comment).

I'm sorry for jumping in like this without asking first -- I initially thought @PaulRoms was a repo maintainer and that I could offload to free up time to be used more impactfully.

Description

Adds a snapshot test for fetch_production with a passed target_datetime, which since #7739 works.

About how this PR was created

I modified the fetch_production function to dump files with the response data, like this:

    # ...
    initial_resp = session.get(DAILY_OPERATION_URL)
    with open("get_historical.html", "w") as f:
        f.write(initial_resp.text)

    # ...
    data_resp = session.post(DAILY_OPERATION_URL, data=post_data)
    with open("post_historical.html", "w") as f:
        f.write(data_resp.text)

Then I just moved these files to the mocks folder and copy-pasted-tweaked a snapshot test.

Double check

  • I have tested my parser changes locally with poetry run test_parser "zone_key"
  • I have run pnpx prettier@2 --write . and poetry run format in the top level directory to format my changes.

@github-actions github-actions bot added parser python Pull requests that update Python code tests labels Jan 14, 2025
@consideRatio consideRatio mentioned this pull request Jan 14, 2025
2 tasks
Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WoHoo!

Nice work!

Thanks!

@VIKTORVAV99 VIKTORVAV99 merged commit 09cf337 into electricitymaps:master Jan 14, 2025
22 checks passed
@PaulRoms
Copy link
Contributor

Thank you @consideRatio !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser python Pull requests that update Python code tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants