Code for pluralsight course Unit Testing with Python by Emily Bache
- Stub - returns a hard coded answer to any query (no logic)
 - Fake - is a real implementation, yet unsuitable for production
 - Mock - is as a Stub, but additionally verifies interactions
 - Test Spy - lets you query afterwards to find out what happened
 - Dummy - is for when the interface requires an argument
 - Monkeypatching - changing code at runtime
 
- Unit Testing with Python - Basic Example Using unittest
 - Why and When Should You Write Unit Tests
 - Using Pytest for Unit Testing in Python
 - Testable Documentation with Doctest
 - Test Doubles: Mocks, Fakes and Stubs
 - Test Coverage and Parameterized Tests
 
python -m unittest -vpython -m pytest --doctest-modules -vShould be in proper folder:
python -m doctest test_* -vcoverageandpytest-covpackages are required- Add 
pragma: no coverto exclude code from coverage report 
Terminal report:
python -m pytest --cov-report term-missing --cov <target>HTML report:
python -m pytest --cov-report html --cov <target>To generate report:
python -m coverage run -m unittestTo view report in terminal:
python -m coverage reportTo view report in HTML:
python -m coverage html- Create 
.coveragerc - Add - Add following code to it
 
[run]
branch=True