You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MeetingHostTests fail depending on test order: MeetingFactory's meeting number and date depend on earlier tests #11971
This was found with the extra InterimTests from #11942. On main the same pair passes, but only because InterimTests happens to create fewer meetings there.
Cause
MeetingFactory(type_id='ietf') without a number gets '%02d' % (n + 80), where n is factory_boy's sequence counter. The counter keeps counting across tests within a run; the per-test database rollback doesn't reset it.
The meeting's date is derived from its number ((num - 2) // 3 + 1985 for the year), so the date depends on how many meetings earlier tests created.
After creating a host, each of these tests calls assertRedirects(r, <materials URL>), which also fetches the materials page and expects a 200. The materials view redirects meetings numbered over 96 to their proceedings once the correction cutoff (the start date plus 50 days by default) has passed.
So the tests fail whenever earlier tests push the number into 97–126. Run alone, the meeting is IETF 80 (2011) and the page renders. After InterimTests it reaches 103 (2018-11-20) and the page redirects. Further up, the derived dates are in the future, so the full suite passes.
The failing range depends on today's date: each year the factory's derived dates pass, about three more numbers move into it.
MeetingFactory(type_id='ietf') without a number appears in 43 places across eight test modules. Any of them that depends on the meeting's date relative to today has the same exposure.
Options
Fix the four tests: give their meetings an explicit number and date, or assert only the redirect's target with fetch_redirect_response=False. That is enough to make them deterministic.
Fix MeetingFactory: stop deriving the date from a sequence that crosses test boundaries, for example by defaulting to a date relative to today or by resetting the sequence per test. This removes the whole class of problem, but every test that relies on the current numbers or dates would need checking.
Activity
fix: make MeetingFactory defaults independent of test order and date (i…