Closed Bug 1455246 Opened 6 years ago Closed 6 years ago

Improve py.test environment

Categories

(Webtools Graveyard :: Pontoon, enhancement, P2)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: adrian, Assigned: adrian)

References

Details

Attachments

(1 file)

There are a few things I dislike with our current pytest setup: 

1. Tests are in a separate folder (/tests), making them harder to discover. 
2. We cannot use --reuse-db, making running tests locally a pain.
3. The pytest command doesn't accept files as parameters, and will always run the entire test suite, unless using the -k option (but it's really not ideal).
4. We have to run two different test runners (pytest and django) to run the entire Python test suite.

I want to fix all that.
Commit pushed to master at https://github.com/mozilla/pontoon

https://github.com/mozilla/pontoon/commit/30c81b0a923accbe2e905f2ba93a456690412007
Fix bug 1455246 - Improve pytest environment. (#972)

* Fix bug 1455246 - Improve pytest environment.

This commit moves the pytest configuration into a more discoverable file (pytest.ini), and changes it to run tests in a more standard manner. Running pytest now runs all django tests in the pontoon folder (and not tests in /tests) and reuses the database between runs. It also enables passing files and folders to the pytest command.

* Moved batch tests back to pontoon.

* Moved teams tests back to pontoon.

* Fixed teams tests.

* Moved machinery tests back to pontoon.

* Fix machinery tests.

* Moved tags tests back to pontoon.

* Moved some fixture files.

* Migrated the site_matrix fixture over, moved it to a dedicated test app.

* Load base fixtures for all tests.

* Fix tags tests.

* Run migrations every time, as migrations create data that is required by some tests.

* Remove django test runnner.

* Fixed PEP8 violations, added a missing init file.

* Moved base tests back to pontoon.

* Fix base tests.

* Moved checks tests back to pontoon.

* Fix checks tests.

* Refactor fixtures to avoid code duplication.

* Removed remains of old pytest directory.

* Use factories from test app.

* Moved final checks test to pontoon.

* Address review comments.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Priority: -- → P2
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: