8000 Speed up the tests · Issue #314 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content
Speed up the tests #314
Open
Open
@sigmavirus24

Description

@sigmavirus24

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_mockon 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)

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/6621137-speed-up-the-tests?utm_campaign=plugin&utm_content=tracker%2F183477&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F183477&utm_medium=issues&utm_source=github).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0