Testing Your Python Code
summary
Shows concrete unit and integration examples that run without hardware: a regex validator for router names, a mocked netmiko SSH connector that asserts connect called with specific args, and an HTTP GET tested with requests-mock and a pytest fixture returning saved JSON. Uses pytest, unittest.mock autospec, netmiko, betamax, hypothesis and coverage. Presents templates for per-test setup/teardown and class-level integration setup/teardown, demonstrates tests passing and snapshots created/restored so workflows are verifiable without touching production.
AI-written summary · about
chapters (12)
- 0:00Start
- 1:54Disclaimers
- 2:31Motivation: why test?
- 3:52Motivation: why test for network automation?
- 5:36Types of tests and network automation
- 6:37Unit testing
- 7:05Integration testing
- 7:50System testing
- 8:06Acceptance testing
- 20:11Unit Test Template
- 21:07Integration Tests
- 23:53Interop DIGITAL
related talks
49mFor those about to Mock I salute you!
29mUnit testing in the real world with mock
26mMocking: virtual reality for your Python tests
32mMock It Till You Make It: How to Verify Your External Mocks Without Ever...
02h 13mPython Unit Testing with Pytest and Mock
39mIntro to Mocking: Why Unit Testing Doesn't Have To Be So Hard
35mTesting: Choose Your Weapons
41mTesting is Fun in Python!
