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

Unit tests should be independent #3401

Open
alexcottner opened this issue Apr 1, 2024 · 0 comments
Open

Unit tests should be independent #3401

alexcottner opened this issue Apr 1, 2024 · 0 comments

Comments

@alexcottner
Copy link
Contributor

alexcottner commented Apr 1, 2024

While upgrading to pytest v8, it was discovered that our unit tests have a lot of interdependence. Creating this issue to act as an epic.

Unit tests in kinto should:

  1. Be independent of each other. We should be able to run one test module with the same test results as if we had run all tests.
  2. Not create side effects. If a test needs to create a mock or a test file, that mock or test file should be removed during teardown.

Examples of issues:

  1. Running pytest tests/test_views_version.py results in a test error because it relies on something setup in another test
  2. Several tests appear to have setUp and setUpClass methods that create test state, but no associated teardown methods that reset it

Given how extensive our test scenarios are in kinto (over 2000 at this time), this may take significant effort to research and correct all cases. We should probably do this in phases to make the PR's readable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant