Skip to content
0:00 / 0:00

#hypothesis#property-basedtesting#designbycontract

Hillel Wayne - Beyond Unit Tests: Taking Your Testing to the Next Level - PyCon 2018

PyCon 2018

22K subscribers • 3 videos on Hallway

YouTube
  • Recommended by 3 people: 3 on Hacker News.
  • A classic. People kept recommending it from 2018 to 2023.
  • Presented by Hillel Wayne, software consultant
  • Linked in the descriptiondeadpixi/contractsPyCon/2018-slides

Intermediate. Assumes working knowledge.

38K views8 years ago3 recommendations

Tools and practiceProgramming languagesTestingPython

Hillel Wayne explains how to use property-based testing with Hypothesis and design-by-contract to write more reliable Python code.

Speaker: Hillel Wayne You've used pytest and you've used mypy, but bugs are still slipping through your code. What's next? In this talk, we cover two simple but powerful tools for keeping your code problem-free. Property-based testing, provided by the [Hypothesis](hypothesis.readthedocs.io/en/latest/) library, lets you run hundreds of tests from a single template. Contracts, via [dpcontracts](github.com/deadpixi/contracts), make your program test itself. You'll learn how and why to use these tools and how to combine them with the rest of your testing suite. Slides can be found at: speakerdeck.com/pycon2018 and github.com/PyCon/2018-slides

Why it's here

3 people recommend this

What people say. Highly recommended as a concise and convincing introduction to property-based testing and design-by-contract.

jononoron Hacker News • Recommends

On “The Case for Formal Methods”

I found this talk (by the same person being interviewed) to be concise and convincing on how to do better than typical practice, without going to full formal methods. Hillel Wayne - Beyond Unit Tests: Taking Your Testing to the Next Level - PyCon 2018 link to this video

sn9on Hacker News • Recommends

On “Ask HN: Best talks of 2018?”

Some of my favorite talks from Strange Loop: * Contracts For Getting More Programs Less Wrong: link * "It's Just Matrix Multiplication": Notation for Weaving: link * Hackett: a metaprogrammable Haskell: link * Git from the Ground Up: link From PyCon: * Beyond Unit Tests: Taking Your Testing to the Next Level: link to this video * Dataclasses: The code generator to end all code generator: link * Automating Code Quality: link There are probably more I might add later as I remember them.

spionon Hacker News • Recommends

On “What if writing tests was a joyful experience?”

…s (never accidentally swallow content!) - your postconditions can surprisingly often fully describe the desired function behavior - with sufficient amount of pre and postconditions, your property tests look like "exercise the module or entire system with random actions" -> unit and integration tests (see Hilel Wayne's excellent video on this topic link to this video ) Some things that could really help modernize design by contract - Test at a certain sampling rate in production for expensive contracts (do not turn them off) - Report contract violations via observability mechanisms (tracing, sentry etc) - Better language support for contract DSLs…