Loading topic
pip install pytest has been run. You will write a first test file and learn the rules pytest uses to find tests. Most "my tests don't run" problems come from those r2 min readpip install pytest. It also assumes you have written a test file or two. Here you will run pytest, choose which tests run, and read what it prints.2 min readpytest from a terminal, and have a test file that pytest discovers. It uses the cart.py module from earlier in the tutorial.2 min readassert from the previous chapter.2 min readassert, and that you know Python stores floats in binary. It uses the total function from cart.py in earlier chapters.2 min readassert, and read pytest's output. It also assumes you know what a Python generator is.2 min read@pytest.fixture and know how pytest finds test files. Here you will move fixtures out of individual test files so that many files can use them.2 min readassert, run pytest from a terminal, and read a failure report. It uses the cart.py module from earlier chapters.2 min readassert, and write parametrized tests. A marker is a label attached to a test with the @pytest.mark.<name> decorator. Markers let you skip tests, expect failures, or pick groups of tests from the command line.2 min readassert, and request a fixture by naming it as a test argument. pytest ships with fixtures that need no definition and no import. You request them by name, and pytest sets them up and cleans them up for you. Three of them cover most isolati2 min read[tool.pytest.ini_options] table, which holds the settings you would otherwise retype on every command line.2 min readtestpaths in pyproject.toml. It covers how to lay out a test suite once it outgrows a single file.2 min readparametrize, and run pytest from a terminal. It collects habits that keep a suite useful as the project grows.2 min read