Skip to content

tests: Make freezegun optional - #1509

Closed
moto-timo wants to merge 1 commit into
python-babel:masterfrom
moto-timo:tests-optional-freezegun
Closed

moto-timo wants to merge 1 commit into
python-babel:masterfrom
moto-timo:tests-optional-freezegun

Conversation

@moto-timo

Copy link
Copy Markdown

tests/conftest.py imports freezegun at module level, so the whole test suite fails at collection when freezegun is not installed, although only a few tests freeze the time.

Import freezegun optionally and skip only the tests that need it, as is already done for pytz, jinja2 and setuptools: the frozen_time fixture, the frozen part of test_format_time, test_parse_date_two_digit_year, and the frontend merge and concat modules, whose autouse fixtures freeze the time for every test.

This lets downstream builds run the test suite where freezegun is not packaged, such as the OpenEmbedded on-target tests.

tests/conftest.py imports freezegun at module level, so the whole test
suite fails at collection when freezegun is not installed, although
only a few tests freeze the time.

Import freezegun optionally and skip only the tests that need it, as is
already done for pytz, jinja2 and setuptools: the frozen_time fixture,
the frozen part of test_format_time, test_parse_date_two_digit_year,
and the frontend merge and concat modules, whose autouse fixtures
freeze the time for every test.

This lets downstream builds run the test suite where freezegun is not
packaged, such as the OpenEmbedded on-target tests.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
@akx akx self-assigned this Nov 29, 2026
@codspeed

codspeed Bot commented Nov 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 88 untouched benchmarks


Comparing moto-timo:tests-optional-freezegun (5c9587e) with master (394f91a)

Open in CodSpeed

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.43%. Comparing base (394f91a) to head (5c9587e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1509   +/-   ##
=======================================
  Coverage   94.43%   94.43%           
=======================================
  Files          27       27           
  Lines        5051     5051           
=======================================
  Hits         4770     4770           
  Misses        281      281           
Flag Coverage Δ
macos-26-3.10 93.52% <ø> (ø)
macos-26-3.11 93.46% <ø> (ø)
macos-26-3.12 93.72% <ø> (ø)
macos-26-3.13 93.72% <ø> (ø)
macos-26-3.14 93.70% <ø> (ø)
macos-26-3.15 93.70% <ø> (ø)
macos-26-3.9 93.46% <ø> (ø)
macos-26-pypy3.11 93.42% <ø> (ø)
macos-26-pypy3.12 93.68% <ø> (ø)
ubuntu-24.04-3.10 93.54% <ø> (ø)
ubuntu-24.04-3.11 93.48% <ø> (ø)
ubuntu-24.04-3.12 93.74% <ø> (ø)
ubuntu-24.04-3.13 93.74% <ø> (ø)
ubuntu-24.04-3.14 93.72% <ø> (ø)
ubuntu-24.04-3.15 93.72% <ø> (ø)
ubuntu-24.04-3.9 93.48% <ø> (ø)
ubuntu-24.04-pypy3.11 93.44% <ø> (ø)
ubuntu-24.04-pypy3.12 93.70% <ø> (ø)
windows-2025-3.10 93.61% <ø> (ø)
windows-2025-3.11 93.55% <ø> (ø)
windows-2025-3.12 93.81% <ø> (ø)
windows-2025-3.13 93.81% <ø> (ø)
windows-2025-3.14 93.79% <ø> (ø)
windows-2025-3.15 93.79% <ø> (ø)
windows-2025-3.9 93.55% <ø> (ø)
windows-2025-pypy3.11 93.55% <ø> (ø)
windows-2025-pypy3.12 93.81% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@akx

akx commented Nov 29, 2026

Copy link
Copy Markdown
Member

Thanks! I'll do slightly better: we won't need Freezegun at all soon (#1520).

@akx akx closed this in #1520 Nov 29, 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.

2 participants