Category: Internals

Assertion rewriting in Pytest part 4: The implementation

tim February 24, 2018 No Comments Internals

Part 1, part 2 and part 3 looked at some background to why Pytest does something unusual and the principles behind how it works. Now it’s time to look into the implementation. First it’s worth fleshing out how the AST stuff fits in to the original motivation of getting better assertions. Our original problem was that we had something […]

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

tim January 20, 2018 No Comments Internals

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 […]

Page 3 of 3