Skip to content

Stop a long-digit-run test depending on the current year - #1578

Merged
AdrianAtZyte merged 1 commit into
scrapinghub:masterfrom
serhii73:fix-long-digit-test-year
Nov 13, 2026
Merged

AdrianAtZyte merged 1 commit into
scrapinghub:masterfrom
serhii73:fix-long-digit-test-year

Conversation

@serhii73

Copy link
Copy Markdown
Collaborator

What was wrong

TestLongDigitRuns.test_trailing_quantity_too_long_for_int_keeps_the_date_before_it searches "Sep 15, 2026 10:50 AM <5000 digits> years after" and expects datetime(2026, 9, 15). The text it matches is only "Sep 15", so the year comes from the current date, and the test fails from 2027-01-01: with the clock frozen at 2027-01-02 it gets 2027-09-15.

How it is fixed

The call passes settings={"RELATIVE_BASE": BASE}, as the other tests in this file already do. BASE (2026-11-03) is defined at the top of the file.

Checks

  • With the clock frozen at 2027-01-02 (freezegun), the test fails on master and passes with this change. With the real clock it passes before and after.

  • The whole suite under the same frozen clock: this is the only test that fails on master and passes with this change. Nine other tests (TestTimestampParser x4, TestDateData.test_repr x5) also fail under freezegun, but they fail the same way with the clock frozen at today's date and pass without freezegun, so they come from freezegun (local time conversion, FakeDatetime in reprs), not from the year.

  • I have read the contributing guide and set up pre-commit.

🤖 Generated with Claude Code

test_trailing_quantity_too_long_for_int_keeps_the_date_before_it reads
"Sep 15" and expects 2026, but the year of a date written without one comes
from the current date, so the test fails from 2027-01-01. Pass
RELATIVE_BASE, as the other tests in this file already do.
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.23%. Comparing base (90544c0) to head (9c1cafc).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1578   +/-   ##
=======================================
  Coverage   99.23%   99.23%           
=======================================
  Files         239      239           
  Lines        4203     4203           
=======================================
  Hits         4171     4171           
  Misses         32       32           

☔ 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.

@AdrianAtZyte
AdrianAtZyte merged commit 95a8470 into scrapinghub:master Nov 13, 2026
18 checks passed
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