diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 30c94dbbe..52b871c3d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,12 @@ jobs: toxenv: docs - python-version: "3.13" toxenv: twinecheck + - python-version: "3.13" + toxenv: py + timezone: "Pacific/Auckland" + - python-version: "3.13" + toxenv: py + timezone: "Pacific/Fiji" steps: - uses: actions/checkout@v3 - name: 'Set up Python ${{ matrix.python-version }}' @@ -45,7 +51,9 @@ jobs: python -m pip install --upgrade pip pip install tox - name: Run tests - run: tox -e ${{ matrix.toxenv || 'py' }} + run: | + TZ=${{ matrix.timezone || 'UTC' }} echo "Running tests with timezone: $TZ" + TZ=${{ matrix.timezone || 'UTC' }} tox -e ${{ matrix.toxenv || 'py' }} - name: Upload coverage.xml to codecov uses: codecov/codecov-action@v5 with: diff --git a/tests/test_search.py b/tests/test_search.py index 252195503..cd838c2da 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -10,7 +10,7 @@ from dateparser_data.settings import default_parsers from tests import BaseTestCase -today = datetime.datetime.today() +today = datetime.datetime.now(tz=pytz.timezone("UTC")) class TestTranslateSearch(BaseTestCase): diff --git a/tox.ini b/tox.ini index 312b4b3ae..fac54bd7a 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ deps = atheris; python_version < '3.12' commands = pytest --cov=dateparser --cov-report=xml {posargs: tests} +passenv = TZ [testenv:all] basepython = python3.13