This assumes you have setup your environment as described in [run_tests.md] and that you are in your virtualenv.
-
Try enhancing your tests in
tests/test_catmath.pyto make use ofpytest.mark.parametrize.@pytest.mark.parametrize('age', [ ... ]) def test_cat_to_hooman(age): ...
-
Try enhancing your tests in
tests/test_safecatmath.pyto also usepytest.mark.parametrize. -
Take a look at the
McCatteryclass incatinabox/mccattery.py. Doesn't it look an awful lot like theCattery?In this step you will attempt (and succeed!) in making the tests in
tests/test_cattery.pyrun against both theCatteryandMcCattery. This step assumes that you have completed the previous activity where you refactored the cattery tests to use a fixture.@pytest.fixture def cattery_client(): return cattery.Cattery() def test_the_things(cattery_client): ...
First we start by parameterizing the fixture.
@pytest.fixture(params=[ ... ]) def cattery_client(request): ...
Don't worry about the magical
requestargument for now. It can do a lot of things, but we'll be using its ability to access thatparamsargument we passed topytest.fixture.Everytime pytest goes to create this fixture, it will assign the next thing in
paramstorequest.param. As you hopefully heard from the slides, pytest will run every possible permutation of fixtures and the tests that require them.Think of all the testing possibilities!
4. When the tests run successfully, push them to your pull request:
```bash
(catpy)user@host:~/catinabox$ git commit -a
(catpy)user@host:~/catinabox$ git push origin master
