Assertion rewriting in Pytest part 1: Why it’s needed

Pytest is fast becoming the de facto standard for Python unit testing. One of its most distinctive features is that it allows (indeed, encourages) you to use plain old Python assert rather than having to use library-specific assertSomeLongChainOfConditions methods. For example, instead of writing: def test_generate_list(self): results = generate_list() self.assertListContains(results, ‘foo’) You can write: def […]