Skip to content

Commit

Permalink
tests/u, tests/i: set TZ variable before running tests
Browse files Browse the repository at this point in the history
* We were using the pytest-env plugin to run the tests in a non-UTC time
  zone.
* The pytest-env plugin doesn't work with pytest-xdist so this was being
  ignored.
* Also due to the way TZ support works in Python, changing the env var
  whilst Python is running may or may not result in changes.
  • Loading branch information
oliver-sanders committed Dec 13, 2023
1 parent ae25de0 commit be46a11
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ jobs:
include:
- os: 'macos-latest'
python-version: '3.7'

env:
# Use non-UTC time zone
TZ: XXX-09:35
PYTEST_ADDOPTS: --cov --cov-append -n 5 --color=yes

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 1 addition & 4 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ 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
ELLIPSIS
asyncio_mode = auto
markers=
linkcheck: Test links
linkcheck: Test links
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,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

0 comments on commit be46a11

Please sign in to comment.