cgwire / zou

Zou is the Kitsu API. It allows you to store and manage your production data
https://zou.cg-wire.com
GNU Affero General Public License v3.0
170 stars 104 forks source link

Feature/test performance - pytest speed up #864

Closed scottmcdonnell closed 2 weeks ago

scottmcdonnell commented 2 months ago

Problem pytest all tests running very slow as all database tables are created and dropped for each test

Solution move the table creation and drop to once per class setUpClass and tearDownClass. Set up a Sqlalchemy session in each task setUp that is rolled back in tearDown.

Result: big speed increase in running tests.

frankrousseau commented 2 months ago

Hello @scottmcdonnell,

Thank you for this very helpful contribution. Could you make all tests green? If not we'll have a look at it. It seems most of them are ok.

scottmcdonnell commented 1 month ago

I took this speed up from another project of ours and adjusted it from pytest fixtures to your unit test classes. Unfortunately, I don't have the bandwidth at the moment to debug the few tests that are failing. If you don't get to it I can look at it later this month.