- 1. Testing
- 1.1. Traditional Organizations
- 1.2. Quality Assurance
- 1.3. Web age Organizations
- 1.4. TDD vs Testing as an Afterthought
- 1.5. Why test?
- 1.6. Testing Modes
- 1.7. Testing Applications
- 1.8. Testing What to test?
- 1.9. Testing in Python
- 1.10. Testing Environment
- 1.11. Testing Setup - Fixture
- 1.12. Testing Resources
- 2. Testing with unittest
- 2.1. Use a module
- 2.2. Test a module
- 2.3. The tested module
- 2.4. Testing - skeleton
- 2.5. Testing
- 2.6. Test examples
- 3. Testing with PyTest
- 3.1. Pytest features
- 3.2. Test methods
- 3.3. Pytest setup
- 3.4. Pytest - AUT - Application Under Test
- 3.5. How to use the module?
- 3.6. Pytest - simple passing test
- 3.7. Pytest failing test in one function
- 3.8. Pytest failing test separated
- 3.9. Pytest run all the test files
- 3.10. Exercise: test simple module
- 3.11. Pytest expected exception
- 3.12. Pytest a nice Fibonacci example
- 3.13. Pytest testing Fibonacci
- 3.14. Pytest expected exception
- 3.15. Pytest testing expected exception
- 3.16. Pytest Change the text of the exception
- 3.17. Pytest Missing exception
- 3.18. Pytest Other exception is raised
- 3.19. Pytest No exception is raised
- 3.20. Exercise: test more exceptions
- 3.21. Solution: test more exceptions
- 3.22. PyTest: Multiple Failures
- 3.23. PyTest: Multiple Failures output
- 3.24. PyTest Selective running of test functions
- 3.25. PyTest: stop on first failure
- 3.26. Pytest: expect a test to fail (xfail or TODO tests)
- 3.27. Pytest: expect a test to fail (xfail or TODO tests)
- 3.28. PyTest: show xfailed tests with -rx
- 3.29. Pytest: skipping tests
- 3.30. Pytest: show skipped tests with -rs
- 3.31. Pytest: show extra test summmary info with -r
- 3.32. Pytest: skipping tests output in verbose mode
- 3.33. Pytest verbose mode
- 3.34. Pytest quiet mode
- 3.35. PyTest print STDOUT and STDERR using -s
- 3.36. Exercise: test math functions
- 3.37. Exercise: test this app
- 3.38. Exercise: test the csv module
- 3.39. Solution: Pytest test math functions
- 3.40. Solution: Pytest test this app
- 3.41. Solution: test the csv module
- 3.42. PyTest using classes
- 3.43. Exercise: module
- 3.44. Exercise: Open Source
- 3.45. Parametrize PyTest with pytest.mark.parametrize
- 3.46. Parametrize PyTest with multiple parameters
- 3.47. Pytest and forking
- 3.48. Exercise: Write tests for script combining files
- 3.49. Solution: Write tests for script combining files
- 3.50. Pytest: Flask echo
- 3.51. Pytest: testing Flask echo
- 3.52. Pytest resources
- 3.53. Anagram on the command line
- 3.54. PyTest testing CLI
- 4. Pytest assert
- 4.1. PyTest failure reports
- 4.2. PyTest compare numbers
- 4.3. PyTest compare numbers relatively
- 4.4. PyTest compare strings
- 4.5. PyTest compare long strings
- 4.6. PyTest is one string in another strings
- 4.7. PyTest test any expression
- 4.8. PyTest element in list
- 4.9. PyTest compare short lists
- 4.10. PyTest compare short lists - verbose output
- 4.11. PyTest compare lists
- 4.12. PyTest compare dictionaries - different values
- 4.13. PyTest compare dictionaries - missing-keys
- 5. PyTest Fixtures
- 5.1. PyTest: What are Fixtures?
- 5.2. PyTest: test with functions
- 5.3. PyTest Fixture setup and teardown xUnit style
- 5.4. PyTest Fixture setup and teardown output
- 5.5. PyTest: Fixture Class setup and teardown
- 5.6. PyTest: Fixture Class setup and teardown output
- 5.7. What is Dependency injection?
- 5.8. Pytest fixture - tmpdir
- 5.9. Pytest and tempdir
- 5.10. Pytest CLI key-value store
- 5.11. Pytest testing key-value store - environment variable
- 5.12. Pytest testing key-value store - environment variable (outside)
- 5.13. Application that prints to STDOUT and STDERR
- 5.14. Pytest capture STDOUT and STDERR with capsys
- 5.15. PyTest - write your own fixture
- 5.16. Pytest Fixture - autouse fixtures
- 5.17. Share fixtures among test files: conftest.py
- 5.18. Manual fixtures (dependency injection)
- 5.19. Pytest Fixture providing value
- 5.20. Pytest Fixture providing value with teardown
- 5.21. Pytest create fixture with file(s) - app and test
- 5.22. Pytest create fixture with file(s) - helper function
- 5.23. Pytest create fixture with file(s) - fixture
- 5.24. Pytest with Docker - application
- 5.25. Pytest with Docker - test
- 5.26. Pytest with Docker - improved
- 5.27. Pytest fixture inject data
- 5.28. Pytest fixture for MongoDB
- 5.29. Pytest parameters
- 5.30. Pytest parametrized fixture
- 5.31. Pytest parametrized fixture with dependency injection
- 5.32. Pytest parametrized fixture to use Docker
- 6. Pytest Mocking
- 6.1. Pytest: Mocking - why?
- 6.2. Pytest: Mocking - what?
- 6.3. Pytest: What is Mocking? - Test Doubles
- 6.4. Pytest: Monkey Patching
- 6.5. Pytest: Hard-coded path
- 6.6. Pytest: Hard-coded path - manually replace attribute
- 6.7. Pytest: Hard-coded path - monkeypatch attribute
- 6.8. Pytest: Hard-coded path - monkeypatch attribute - tempdir
- 6.9. Pytest: Mocking slow external API call
- 6.10. Pytest: Mocking slow external API call - manually replace function
- 6.11. Pytest: Mocking slow external API call - manually replace function - broken remote
- 6.12. Pytest: Mocking slow external API call - monkeypatch
- 6.13. Pytest: Mocking STDIN
- 6.14. Pytest: Mocking STDIN manually mocking
- 6.15. Pytest: Mocking STDIN - monkeypatch
- 6.16. Pytest: Mocking random numbes - the application
- 6.17. Pytest: Mocking random numbes
- 6.18. Pytest: Mocking multiple random numbers
- 6.19. Pytest: Mocking environment variables
- 6.20. Pytest: Mocking time
- 6.21. Pytest: Mocking time (test expiration)
- 6.22. Pytest: mocking specific timestamp with datetime
- 6.23. Pytest: mocking specific timestamp with datetime
- 6.24. Pytest: mocking datetime.date.today
- 6.25. Pytest: mocking datetime date
- 6.26. Pytest: One dimensional spacefight
- 6.27. Pytest: Mocking input and output in the game
- 6.28. Pytest: Mocking input and output in the game - no tools
- 6.29. Pytest: Mocking random in the game
- 6.30. Pytest: Mocking random in the game - no tools
- 6.31. Pytest: Flask app sending mail
- 6.32. Pytest: Mocking Flask app sending mail
- 6.33. Pytest: Mocking - collecting stats example
- 7. Pytest command line options
- 7.1. PyTest: Run tests in parallel with xdist
- 7.2. PyTest: Order of tests
- 7.3. PyTest: Randomize Order of tests
- 7.4. PyTest: Force default order
- 7.5. PyTest test discovery
- 7.6. PyTest test discovery - ignore some tests
- 7.7. Pytest dry-run - collect-only
- 7.8. PyTest select tests by name
- 7.9. Pytest use markers to select tests
- 7.10. PyTest select tests by marker
- 7.11. No test selected
- 7.12. Pytest reporting in JUnit XML or JSON format
- 7.13. Pytest reporting in JUnit XML format
- 7.14. Pytest reporting in JSON format
- 7.15. Pytest JSON report
- 7.16. Add extra command line parameters to Pytest - conftest - getoption
- 7.17. Add extra command line parameters to Pytest - as a fixture
- 7.18. Add extra command line parameters to Pytest - used in the autouse fixtures
- 7.19. PyTest: Test Coverage
- 7.20. Pytest and flake8
- 7.21. Pytest and mypy
- 8. Pytest - other
- 8.1. Testing with Pytest
- 8.2. Testing functions
- 8.3. Testing class and methods
- 8.4. Pytest - execute
- 8.5. Pytest - execute
- 8.6. Pytest simple module to be tested
- 8.7. Pytest simple tests - success
- 8.8. Pytest simple tests - success output
- 8.9. Pytest simple tests - failure
- 8.10. Pytest simple tests - failure output
- 8.11. PyTest bank deposit
- 8.12. PyTest expected exceptions (bank deposit)
- 8.13. PyTest expected exceptions (bank deposit) - no exception happens
- 8.14. PyTest expected exceptions (bank deposit) - different exception is raised
- 8.15. PyTest expected exceptions - divide
- 8.16. PyTest expected exceptions output
- 8.17. PyTest expected exceptions (text changed)
- 8.18. PyTest expected exceptions (text changed) output
- 8.19. PyTest expected exceptions (other exception)
- 8.20. PyTest expected exceptions (other exception) output
- 8.21. PyTest expected exceptions (no exception)
- 8.22. PyTest expected exceptions (no exception) output
- 8.23. PyTest compare short lists - output
- 8.24. Testing Master Mind
- 8.25. Module Fibonacci
- 8.26. PyTest - assertion
- 8.27. PyTest - failure
- 8.28. PyTest - list
- 8.29. Pytest: monkeypatching time
- 8.30. PyTest: no random order