-
Notifications
You must be signed in to change notification settings - Fork 192
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
pytest fixtures vs. "old" unittests crash on CI #3979
Comments
@CasperWA can this be closed? |
Just a general FYI, sometimes this can be due to interference from other (old-style) tests. It's happened to me that running the single relevant test (locally) works fine but once the whole test suite (on CI) is run it will fail. Can't see the logs for these CI runs now, but I think the error message for that particular problem is usually something about no |
Ok, then it's fine to leave this open as a reminder |
@greschd why do you think The only reason to "opt-out" of this IMO is when you have a set of tests, in a single class/module, where you know there will be no interference, so you only need to apply it once for efficiency. On a related note, I also think that |
Most tests should work on any "consistent" database state, i.e. one where a profile is properly configured. Those shouldn't need In plugin tests we sometimes even share part of the database setup (codes, computers) among tests (and do it only once), so there While I don't remember using |
We can also close it if it's not an active issue; IMO the difference in searchability between open and closed issues isn't that significant. |
I think thats a dangerous assumption, but yes I agree that when you are sure this is not the case, and/or you need a certain DB state for a set of tests, then you don't need to use I really don't think there should be a use case for |
Well, if you know that you're trashing the DB (messing with the profile / User or some-such) it could be useful. I guess we'd have to go looking into the plugin test codes to see if anyone actually uses it. |
Sure, its not a massive issue obviously, I just think that test isolation should always be the main priority, with performance considerations secondary. |
Not on github at least: https://github.com/search?q=clear_database_after_test&type=code But many people use I can personally see both stand points (pro/contra removal), and I would certainly agree that relying on setup information being shared between tests can lead to unexpected behavior. (also, clearing the database is a very fast operation; i.e. performance is only a consideration if the setup takes long). Since I don't think it's a big issue, perhaps we better don't touch it for the moment... |
Fixed by #5372 |
The
pytest
fixtures work fine when testingpytest
-style tests locally, but not when run on GitHub Actions.This issue has been mentioned in #3738, specifically in this comment, as well as in #3974, where the issue can be directly seen in the CI runs here and a previous run here.
The text was updated successfully, but these errors were encountered: