Top "Pytest" questions

Simple powerful no-boilerplate testing with Python.

pytest modules using os.environ - Ho do I test it correctly?

currently I am writing some Webapp, but this time I want to learn how to write proper tests for it (…

python environment-variables pytest monkeypatching
How to test a Django model with pytest?

I am getting started with pytest. I have configured pytest, anyway I couldn't found a resource on Django specific testing …

python django pytest django-testing pytest-django
Pytest skips test saying "asyncio not installed"

When testing the following code @pytest.mark.asynico async def test_handle_DATA(mocker): handle_mock = mocker.MagicMock() envelope_mock = …

python pytest python-asyncio pytest-asyncio
How to add a screenshot to allure report with python?

I have this code: # coding: utf-8 from selenium import webdriver import pytest import allure @pytest.yield_fixture(scope='session') def …

python webdriver pytest allure
Disable autouse fixtures on specific pytest marks

Is it possible to prevent the execution of "function scoped" fixtures with autouse=True on specific marks only? I have …

python pytest pytest-django
pytest using fixtures as arguments in parametrize

I would like to use fixtures as arguments of pytest.mark.parametrize or something that would have the same results. …

python pytest
Use docstrings to list tests in py.test

Here is a simple test file: # test_single.py def test_addition(): "Two plus two is still four" assert 2 + 2 == 4 def …

python unit-testing pytest
import file mismatch in pytest

I've got a file in the package with 'test' in its name and when I run pytest I got an …

python pytest pytest-cov
How to start a Uvicorn + FastAPI in background when testing with PyTest

I have an REST-API app written with Uvicorn+FastAPI Which I want to test using PyTest. I want to start …

python testing pytest fastapi uvicorn
How to mock a property

I'm asking how to mock a class property in a unit test using Python 3. I've tried the following, which makes …

python python-3.x pytest python-unittest python-mock