Description
Currently if you do:
$ tox -e py34 -- tests/unit
The tests take about 12 seconds. If you just run
$ tox -e py34
The tests take about 16 seconds.
We can experiment with pytest-xdist
to parallelize the tests but I don't think that will help a great deal. I'm pretty sure this arises from the fact that we're making a bunch of new objects for each test. We create a new instance of each class we're testing before each tests and we create a mocked session before each test. Most of what we care about in these tests is that the request generated by github3.py is correct when it's sent to requests. Keeping that in mind, we can probably create the instance of the class and session exactly once and simply call reset_mock
on the mocked session. Not creating and then garbage collecting so many objects will probably improve our test speeds. We just need to make sure we don't lose idempotence because of it (So we should probably start randomizing the ordering of the tests)