Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset translation in test tearDown #2309

Merged

Conversation

richardebeling
Copy link
Member

Fixes order-dependent tests (as caused failure in https://github.com/e-valuation/EvaP/actions/runs/11331145512/job/31510516990)

Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still misses tests like class TestStudentIndexView(WebTestWith200Check): (found by searching for class Test)

@richardebeling richardebeling force-pushed the flaky-tests-translations branch 2 times, most recently from 6079b54 to 0758cb5 Compare October 14, 2024 19:24
@niklasmohrin
Copy link
Member

The second failure with seed 7524442357 still breaks on my machine, now even with two tests failing. Maybe we can use https://github.com/asottile/detect-test-pollution ?

@richardebeling richardebeling force-pushed the flaky-tests-translations branch from 0758cb5 to 2b94bff Compare October 20, 2024 10:58
@richardebeling
Copy link
Member Author

The second failure with seed 7524442357 still breaks on my machine, now even with two tests failing.

The problem was that django.test.TestCase.tearDown doesn't call super.tearDown(), so with inheritance order class TestCase(django.test.TestCase, MyTearDownMixin), the tearDown method of the mixin is never called. Fixed it by swapping the order. ./manage.py test --keepdb --shuffle 7524442357 now works for me.

@Kakadus
Copy link
Collaborator

Kakadus commented Oct 21, 2024

output of rg "def tearDown":

evap/staff/tests/test_views.py
2379:    def tearDown(self):

evap/evaluation/tests/tools.py
33:    def tearDown(self):

evap/grades/tests.py
54:    def tearDown(self):

only evap/evaluation/tests/tools.py calls super().tearDown(), should we add those to the other two?

@niklasmohrin
Copy link
Member

Another seed fixed by this PR 1773734012 :)

The TestCase tearDown implementation doesn't call super, so we need to
inherit form the Mixin first (since MRO is not followed further after
first match)
@richardebeling richardebeling force-pushed the flaky-tests-translations branch from a7bc317 to 84a0ce0 Compare November 4, 2024 21:57
@richardebeling richardebeling merged commit 2b88848 into e-valuation:main Nov 4, 2024
12 checks passed
@richardebeling richardebeling deleted the flaky-tests-translations branch November 4, 2024 23:03
jooooosef pushed a commit to jooooosef/EvaP that referenced this pull request Dec 16, 2024
* Reset translation in test tearDown to fix flakiness

The TestCase tearDown implementation doesn't call super, so we need to
inherit form the Mixin first (since MRO is not followed further after
first match)

* Call super.tearDown() in derived classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants