pytest Quick Start Guide
This is the code repository for pytest Quick Start Guide, published by Packt.
Write better Python code with simple and maintainable tests
What is this book about?
Python's standard unittest module is based on the xUnit family of frameworks, which has its origins in Smalltalk and Java, and tends to be verbose to use and not easily extensible.The pytest framework on the other hand is very simple to get started, but powerful enough to cover complex testing integration scenarios, being considered by many the true Pythonic approach to testing in Python.
This book covers the following exciting features:
- Write and run simple and complex tests
- Organize tests in fles and directories
- Find out how to be more productive on the command line
- Markers and how to skip, xfail and parametrize tests
- Explore fxtures and techniques to use them effectively, such as tmpdir, pytestconfg, and monkeypatch
If you feel this book is for you, get your copy today!
Instructions and Navigations
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
# contents of test_player_mechanics.py
def test_player_hit():
player = create_player()
assert player.health == 100
undead = create_undead()
undead.hit(player)
assert player.health == 80
Following is what you need for this book: This book is for Python programmers that want to learn more about testing. This book is also for QA testers, and those who already benefit from programming with tests daily but want to improve their existing testing tools.
With the following software and hardware list you can run all code files present in the book (Chapter 1-7).
Software and Hardware List
Chapter | Software required | OS required |
---|---|---|
1 to 6 | Python 3 | Windows, Mac OS X, and Linux (Any) |
Related products
Get to Know the Author
Bruno Oliveira Bruno Oliveira is a software developer with 18 years experience working at ESSS, developing desktop and web applications for simulation and numerical analysis for several industry sectors including oil and gas, aerospace, automotive, and chemical processes. Having taken part in the development of an internal testing framework to attend to the various needs of the applications he worked with, and having always been interested in testing and software quality, in 2012, Bruno took note of pytest and immediately fell in love with the project. He started contributing whenever he could and has been a pytest core contributor since 2014.
Suggestions and Feedback
Click here if you have any feedback or suggestions.