You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Using mocks in Python](http://www.drdobbs.com/testing/using-mocks-in-python/240168251)
134
-
*[unittest](https://docs.python.org/3/library/unittest.html) is a
135
-
framework available in Python Standard Library.
136
-
[Dr.Dobb's on Unit Testing with Python](http://www.drdobbs.com/testing/unit-testing-with-python/240165163)
137
-
*[doctest](https://docs.python.org/3/library/doctest.html) searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown. Always use this if you have example code in your documentation to make sure your examples actually work.
138
-
139
-
Using `pytest` is preferred over `unittest`, `pytest` has a much more concise syntax and supports many useful features.
140
-
141
-
Please make sure the command `python setup.py test` can be used to run your tests. When using `pytest`, this can be easily configured as described in the [`pytest` documentation](https://docs.pytest.org/en/latest/goodpractices.html#integrating-with-setuptools-python-setup-py-test-pytest-runner).
130
+
Use [pytest](https://docs.pytest.org/) as the basis for your testing setup.
131
+
This is preferred over the `unittest` standard library, because it has a much more concise syntax and supports many useful features.
132
+
133
+
It [has many plugins](https://docs.pytest.org/en/stable/plugins.html).
134
+
For linting, we have found `pytest-pycodestyle`, `pytest-mypy` and `pytest-flake8` to be useful.
135
+
Other plugins we had good experience with are `pytest-cov`, `pytest-html` and `pytest-xdist`.
136
+
137
+
Creating mocks can also be done within the pytest framework by using the `mocker` fixture provided by the `pytest-mock` plugin or by using `MagicMock` and `patch` from `unittest`.
0 commit comments