Top "Pytest" questions

Simple powerful no-boilerplate testing with Python.

long running py.test stop at first failure

I am using pytest, and the test execution is supposed to run until it encounters an exception. If the test …

python pytest
coverage.py does not cover script if py.test executes it from another directory

I got a python script which takes command line arguments, working with some files. I'm writing succeeding tests with py.…

python pytest coverage.py
Create and import helper functions in tests without creating packages in test directory using py.test

Question How can I import helper functions in test files without creating packages in the test directory? Context I'd like …

python unit-testing pytest
py.test does not find tests under a class

I am trying to create test classes that aren't unittest based. This method under this class class ClassUnderTestTests: def test_…

python unit-testing pycharm pytest
Coverage.py warning: No data was collected. (no-data-collected)

I am trying to find the coverage using coverage module for a django project but gets Coverage.py warning: No …

python django pytest coverage.py test-coverage
TypeError: attrib() got an unexpected keyword argument 'convert'

This error occurred during automated testing of a python project on the CI server using pytest. I'm using pytest==4.0.2. This …

python pytest
pytest-mock mocker in pytest fixture

I'm trying to find out why I don't seem to be able to use a mocked return value in a …

python unit-testing mocking pytest fixtures
"py.test" vs "pytest" command

The py.test command is failing in my case, whereas pytest is running totally fine. I use the pytest-flask plugin: …

python flask python-import pytest
Unable to debug in pycharm with pytest

I cannot debug in PyCharm using py.test. All the test suite is running ok in "Debug mode" but it …

pycharm pytest
Getting error ImportMismatchError while running py.test

When I am running tests locally its working fine, but after creating the docker and running inside the container I …

python docker pytest