Skip to content

Fix failing tests#67

Merged
sam-watttime merged 2 commits intomainfrom
add-pytz-dependency
Apr 14, 2026
Merged

Fix failing tests#67
sam-watttime merged 2 commits intomainfrom
add-pytz-dependency

Conversation

@sam-watttime
Copy link
Copy Markdown
Contributor

@sam-watttime sam-watttime commented Apr 7, 2026

What

Fix failing tests

Why

To ensure that our tests pass so that we can run them every 30 minutes as a github action

How

Add pytz as a dependency annd replace hardcoded request start times

@sam-watttime sam-watttime requested a review from xginn8 as a code owner April 7, 2026 19:20
@sam-watttime sam-watttime changed the title Add 'pytz' to install_requires in setup.py to try and fix failing tests Fix failing tests Apr 8, 2026
@sam-watttime sam-watttime requested review from jcofield and removed request for xginn8 April 8, 2026 17:36
@sam-watttime
Copy link
Copy Markdown
Contributor Author

Our tests were failing due to two issues:

  1. our pandas dependency is open ended. Newer versions of pandas (3.0) no longer include pytz, which we rely on. This was added as a dependency.
  2. We released new models for CAISO_NORTH, which is used as the test region. The new models do not have the same historical backfill (e.g. 2024 data). To fix this I changed hard coded dates in the tests to relative dates (e.g. one month ago). This may create more noise (e.g. due to intermittent data outages) if this becomes problematic in the future we could consider an alternative approach of using my-access to get the start data for the most recent model, and pull data bounded by that.

For now, this will fix failing tests and should be more robust to changes in the future.

@jcofield
Copy link
Copy Markdown
Contributor

jcofield commented Apr 8, 2026

  1. our pandas dependency is open ended. Newer versions of pandas (3.0) no longer include pytz, which we rely on. This was added as a dependency.

Note we are still allowing an unsupported python 3.8 so pytz could be necessary. I have added a task to upgrade this package to require python 3.10+ before we release it again.

Copy link
Copy Markdown
Contributor

@jcofield jcofield left a comment

Choose a reason for hiding this comment

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

The nature of the tests here is to test dates which do not change, across 3 years of available data. It would change the nature of these tests to derivce dates at execution time. I suggest we keep the explicit use of a year (formely 2022, 2023, and 2024) and bump the hardcoded date years to valid years, i.e. 2025 and 2026. I have only attempted this for the sdk file but the tcy requires it a well.

Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py Outdated
@sam-watttime sam-watttime force-pushed the add-pytz-dependency branch from 7a6f7e6 to f9d9dd0 Compare April 9, 2026 16:19
@sam-watttime sam-watttime requested a review from jcofield April 9, 2026 20:39
@sam-watttime sam-watttime force-pushed the add-pytz-dependency branch from f9d9dd0 to 3d239ce Compare April 9, 2026 20:44
Comment thread tests/test_sdk.py Outdated
Comment thread tests/test_sdk.py
Comment thread tests/test_sdk.py Outdated
@sam-watttime
Copy link
Copy Markdown
Contributor Author

@jcofield tests are passing locally for me in my 3.11.15 venv. This matches the behavior of the github action which runs for each commit in this PR.

image

@sam-watttime sam-watttime force-pushed the add-pytz-dependency branch 3 times, most recently from 2a17932 to 6d7b881 Compare April 14, 2026 18:46
@sam-watttime
Copy link
Copy Markdown
Contributor Author

After discussion, we went with a simpler solution of bumping years 2022, 2023 -> 2025 and 2024 -> 2026. All tests are passing now. This is in addition to adding the pytz dependency.

@sam-watttime sam-watttime requested a review from jcofield April 14, 2026 19:26
Copy link
Copy Markdown
Contributor

@nsteins nsteins left a comment

Choose a reason for hiding this comment

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

LGTM. I think we should remove pytz from our code in the future, if we can, but that is a different PR

@sam-watttime sam-watttime merged commit 327320a into main Apr 14, 2026
1 check passed
This was referenced Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants