Refactor dummy_region fixture as function#3950
Conversation
|
EDIT: I overlooked that a fixture is involved, which of course will not be part of the rollback after the test. It is still weird that my tests always passed, but the bug is definitely the fixture. Did you observe this behaviour or is this just a conjecture? I got a bit suspicious as the tests are only marked with Unless there is something wrong with this way of running it (e.g. we might suspect the verbosity or that it is not in CircleCI to introduce some side effect) or you actually observed the state of the database containing the dummy language, I think this disproves your statement that it still lingers after the test |
|
|
Also I want to mention on another suggestion that @PeterNerlich brought up: Instead of using a fixture and marking the test as last, we could simply create a function that does the creation of dummy region for us, that we call, wherever it is needed. In that case (if it is not a fixture), where the dummy region creation is part of the test itself, it will not be commited to the database and other tests should not fail if executed afterwards |
|
I have implemented Peter's suggestion now, as I agree that this is the cleaner solution, we should not use a fixture in such a situation |
PeterNerlich
left a comment
There was a problem hiding this comment.
- I figured out why your tests were not failing in the second executing: The test test_hix_rounding is not using the
dummy-regionfixture
I'm confused as to what this means, this doesn't explain to me why no test failed in either configuration. But making it not a fixture makes sense (rather, having it as a fix didn't make sense in the first place without something like #3872) and I just tried the same I did before, with no test failing. If you have any combination of tests that should result in a failure given the "right" order, I will try that too on develop and here!
I am embarassed: Somehow I read your log output as "you only executed the one hix test |
0682207 to
4969e15
Compare
Short description
Inside
test_hix.pywe use a dummy region with a dummy language in some tests. If this module is executed before the testtest_no_changes_were_made_messageinsidetest_poi_category_form_view.pythe test fails because of an extra language in the db.Proposed changes
Alternative Solution
transactional_db, where the db is flushed after every testsSide effects
Faithfulness to issue description and design
There are no intended deviations from the issue and design.
How to test
Make sure that
test_no_changes_were_made_messagedoes not fail again on the CircleCi Pipeline in the coming weeks, with this kind of error-messageResolved issues
Related to: #3949
Pull Request Review Guidelines