This assumes you have setup your environment as described in [run_tests.md] and that you are in your virtualenv.
If you get stuck, take a peek at the solution.
-
Refactor the Cattery tests in test_cattery.py to use a py.test fixture.
@pytest.fixture def cattery_client(): ... def test__add_cats__succeeds(cattery_client): ...
-
Try adding a
scope
argument topytest.fixture
. What happens when you try setting it tosession
ormodule
?@pytest.fixture(scope='session') def cattery_client(): ...
-
When you are done, run your tests:
(catpy)user@host:~/catinabox$ python setup.py test
- When the tests run successfully, push them to your pull request:
(catpy)user@host:~/catinabox$ git commit -a
(catpy)user@host:~/catinabox$ git push origin master
Take a look at the builtin fixtures that pytest provides. Are there any that would be useful for these, or any of the previous tests you have written so far? Can you think of some ways you might use fixtures when writing tests for your other projects?
We'd love to discuss this with you!