Top "Pytest" questions

Simple powerful no-boilerplate testing with Python.

Pytest where to store expected data

Testing function I need to pass parameters and see the output matches the expected output. It is easy when function's …

python pytest
How to skip the rest of tests in the class if one has failed?

I'm creating the test cases for web-tests using Jenkins, Python, Selenium2(webdriver) and Py.test frameworks. So far I'm organizing …

python automated-tests selenium-webdriver pytest
py.test logging control

We have recently switched to py.test for python testing (which is fantastic btw). However, I'm trying to figure out …

python pytest
ImportError: No module named base

I'm trying to implement PageObject pattern for my first Login test. While running it I'm receiving the following error: >&…

python python-2.7 selenium-webdriver pytest pageobjects
Ensuring py.test includes the application directory in sys.path

I have a project directory structure as follows (which I think is pretty standard): my_project setup.py mypkg __init__.…

python unit-testing pytest
Printing test execution times and pinning down slow tests with py.test

I am running unit tests on a CI server using py.test. Tests use external resources fetched over network. Sometimes …

python pytest
@Patch decorator is not compatible with pytest fixture

I have encountered something mysterious, when using patch decorator from mock package integrated with pytest fixture. I have two modules: …

python mocking pytest fixtures
"RuntimeError: working outside of application context" when unit testing with py.test

I'm trying to migrate to py.test for the ease of use and auto-discovery of tests. When I run my …

python unit-testing flask pytest pythonpath
VSCode pytest test discovery fails

Pytest test discovery is failing. The UI states: Test discovery error, please check the configuration settings for the tests The …

python visual-studio-code pytest vscode-settings
How do I use pytest with virtualenv?

I installed pytest into a virtual environment (using virtualenv) and am running it from that virtual environment, but it is …

python virtualenv pytest