This PR aims at reducing the duration of the unit tests. It's a big PR but composed of multiple topical commits, so it will be easier to look at each commit in order than the whole diff.
The improvements come from the following changes:
reducing the number of subprocess.call() calls (mostly in test_pagure_admin),
using only one DB session, emptying the DB in test tearDowns (it's surprisingly much faster than copying the DB file and recreating a session for each test, I tested both techniques)
running the tasks synchronously, which removes the need to start a worker process for each test.
With this changes, running the whole test suite takes about 15 minutes.
It would be possible to bring that duration down but only by doing much more invasive changes, like mocking out components that the test is not aimed at testing, so I think I can stop there for now (it's still 3 times faster after all ;-) ). Some tests are reaaaally long, several seconds, and I have yet to identify those. But that's a good start.
This PR aims at reducing the duration of the unit tests. It's a big PR but composed of multiple topical commits, so it will be easier to look at each commit in order than the whole diff.
The improvements come from the following changes:
subprocess.call()calls (mostly intest_pagure_admin),tearDowns (it's surprisingly much faster than copying the DB file and recreating a session for each test, I tested both techniques)With this changes, running the whole test suite takes about 15 minutes.
It would be possible to bring that duration down but only by doing much more invasive changes, like mocking out components that the test is not aimed at testing, so I think I can stop there for now (it's still 3 times faster after all ;-) ). Some tests are reaaaally long, several seconds, and I have yet to identify those. But that's a good start.