Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Adopt-a-pytest

 Adopt-a-pytest

pytest is a testing framework that makes writing and running Python tests simpler. Adopting new tooling in a large system is often a burden. How can you introduce pytest gradually with minimal pain?

With its simplified syntax, powerful fixture behaviors, detailed test reports, and plugin-based architecture, pytest has a lot to offer. Whether you're new to Python unit testing or you've been using unittest for a while, pytest may be something to consider. It's not too hard to get up and running with pytest on a fresh project, but how can you retrofit an existing project without having to refactor the world all at once?

Dane Hillard

July 27, 2019
Tweet

More Decks by Dane Hillard

Other Decks in Technology

Transcript

  1. @easyaspython ! Developing in Python (and Django) for ~7 years

    ! Web app development for ~4 years ! I do hobbies ◦ Lifestyle photographer ◦ Musician ◦ Epicurean ◦ Competitive ballroom dancer ◦ Blogger ◦ Author !5
  2. @easyaspython !9 ! 50+ apps ! 900+ modules ! 300+

    test modules ! 2K+ tests Before: Manual, occasional, often broken Now: Automated*, every commit, not broken
  3. @easyaspython Test discovery !43 Convention unittest pytest Ⓜ test*.py ✅

    Ⓜ test_*.py ✅ ✅ Ⓜ *_test.py ✅ Ⓜ *_tests.py Ⓒ *(unittest.TestCase) ✅ ✅ ⓜ test_* ✅ ✅ Ⓒ Test* ✅ ⓜ test_* ✅ ⓕ test_* ✅