nghieptruong / pytest-Quick-Start-Guide

pytest Quick Start Guide, published by Packt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get this product for $5

Packt is having its biggest sale of the year. Get this eBook or any other book, video, or course that you like just for $5 each

Buy now

Buy similar titles for just $5

pytest Quick Start Guide

pytest Quick Start Guide

This is the code repository for pytest Quick Start Guide, published by Packt.

Author: Bruno Oliveira (@nicoddemus)

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!

https://www.packtpub.com/

Instructions and Navigation

All of the code is organized into folders. For example, Chapter02.

The code looks 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

Errata

  • Page 32 (line 3): pytest -x --lf should be pytest --x --ff.
  • Page 41 (line 11): For more details, go to:https:/ / docs. python. org/ 3/ library/configparser. html should be For more details, go to: https:/ / docs. python. org/ 3/ library/configparser. html
  • Page 83 (line 3): Why pytest use py.local instead of pathlib.Path? should be Why does pytest use py.path.local instead of pathlib.Path?
  • tmpdir is now deprecated in favor of tmp_path as tmpdir_factory is in favor of tmp_path_factory.

Get to Know the Author

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.

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781789347562

About

pytest Quick Start Guide, published by Packt

License:MIT License


Languages

Language:Python 100.0%