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: fix cached point parse contamination between tests #37

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/test_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ jobs:
fail-fast: false # Don't let a failed MacOS run stop the Ubuntu runs
matrix:
os: ['ubuntu-latest']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.10', '3.11']
Copy link
Owner

Choose a reason for hiding this comment

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

Is that change intentional?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, so we test non-UTC on one of the python versions

include:
# mac os test
- os: 'macos-latest'
python-version: '3.7'
python-version: '3.7' # oldest supported version
# non-utc timezone test
- os: 'ubuntu-latest'
python-version: '3.9' # not the oldest, not the most recent version
time-zone: 'XXX-09:35'
env:
TZ: ${{ matrix.time-zone }}
PYTEST_ADDOPTS: --cov --cov-append -n 5 --color=yes
steps:
- name: Checkout
Expand Down
16 changes: 13 additions & 3 deletions cylc/flow/cycling/iso8601.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,12 +943,22 @@ def _interval_parse(interval_string):

def point_parse(point_string: str) -> 'TimePoint':
"""Parse a point_string into a proper TimePoint object."""
return _point_parse(point_string, WorkflowSpecifics.DUMP_FORMAT)
return _point_parse(
point_string,
WorkflowSpecifics.DUMP_FORMAT,
WorkflowSpecifics.ASSUMED_TIME_ZONE
)


@lru_cache(10000)
def _point_parse(point_string, _dump_fmt):
"""Parse a point_string into a proper TimePoint object."""
def _point_parse(point_string: str, _dump_fmt, _tz) -> 'TimePoint':
"""Parse a point_string into a proper TimePoint object.

Args:
point_string: The string to parse.
_dump_fmt: Dump format (only used to avoid invalid cache hits).
_tz: Cycle point time zone (only used to avoid invalid cache hits).
"""
if "%" in WorkflowSpecifics.DUMP_FORMAT:
# May be a custom not-quite ISO 8601 dump format.
with contextlib.suppress(IsodatetimeError):
Expand Down
3 changes: 0 additions & 3 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ testpaths =
cylc/flow/
tests/unit/
tests/integration/
env =
# a weird timezone to check that tests aren't assuming the local timezone
# TZ=XXX-09:35
doctest_optionflags =
NORMALIZE_WHITESPACE
IGNORE_EXCEPTION_DETAIL
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ tests =
pytest-asyncio>=0.17,!=0.23.*
pytest-cov>=2.8.0
pytest-xdist>=2
pytest-env>=0.6.2
pytest>=6
testfixtures>=6.11.0
towncrier>=23
Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,6 @@ async def test_compute_runahead(
'scheduler': {
'allow implicit tasks': 'True',
'cycle point format': 'CCYY',
'cycle point time zone': 'Z'
},
'scheduling': {
'initial cycle point': '0001',
Expand Down
Loading