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

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