Category "pytest"

How to share global variables between tests?

I have a global variable in conftest.py and use it in tests. For example: conftest.py api_version = 'v25' api_url = 'http://www.foobar.com/' + api_version t

how to set up postgres database with pytest-django?

I would like pytest-django to install a Postgres extension when it creates a test database. I've been mucking with conftest.py to try to get this to work, but

Why cant unittest.TestCases see my py.test fixtures?

I'm trying to use py.test's fixtures with my unit tests, in conjunction with unittest. I've put several fixtures in a conftest.py file at the top level of the p

Way to add pytest options outside top level conftest?

I have a project that defines testing support modules, including py.test plugins in a package subdirectory like this: bokeh/_testing ├── __in

Best way to override FastAPI dependencies for testing with a different dependency for each test

According to FastAPI official documentation the recommended way to override the dependencies for testing is to do it globally before all tests are run: asy

Pytest xdist and parametrized tests is performing setup per each thread?

I have a test file that I run with pytest The file has parametrized tests and also a setup that I want it to run only once before any of the tests run, on that

pytest config within pytest.ini not being registered when pytest.ini is in tests subdirectory rather than project root directory

pytest is issuing a warning due to an unknown custom mark when running my test suite despite (hopefully) registering it correctly as per the pytest documentatio

How to remove skipped tests from html report

I am using pytest for automation. I have so many test cases and have one test cases as skipped test like below, def test_step(index, description): """ Logs

py.test: how to get the current test's name from the setup method?

I am using py.test and wonder if/how it is possible to retrieve the name of the currently executed test within the setup method that is invoked before running e

VS Code / Python / Debugging pytest Test with the Debugger

How can I get VS Code to put me into the debugger at the point of failure when running tests with pytest? Pytest catches all errors and asserts, and VS code inv

How do I force pytest to write color output?

How do I force pytest to show the results in color, even when writing to a pipe? There does not seem to be any command line option to do so.

Selenium with Python(POM)

I am new in automation testing. I am learning automation using selenium with python(page object model). From learning YouTube I see that, log in is done for eve

Pytest live logging with parallel execution - possible?

I have a test suite that I run with python3 -mpytest --log-cli-level=DEBUG ... on the build server. The live logs are useful to troubleshoot if the tests get s

Python Selenium - I'm trying to use pytest framework , running into errors

from selenium import webdriver from selenium.webdriver.common.by import By from commonPages.LoginPage import LoginPage from util.InitialSetUp import InitSetup

How to use factory boy to test SQLalchemy association-object models?

I'm using the SQLalchemy association-object pattern (http://docs.sqlalchemy.org/en/rel_1_1/orm/basic_relationships.html#association-object) for three model clas

running a package pytest with poetry

I am new to poetry and want to get it set-up with pytest. I have a package mylib in the following set-up ├── dist │   ├&

running a package pytest with poetry

I am new to poetry and want to get it set-up with pytest. I have a package mylib in the following set-up ├── dist │   ├&

Python ModuleNotFoundError while importing a module in conftest for Pytest framework

My project structure mt-kart | --> src/data_kart | | | -->apis | | | -->__init__.py |

FastAPI: app.dependency_overrides affects other test files

I'm working with FastAPI. I've introduced in my test suite (pytest) app.dependency_overrides to test my app dependencies. Strangely enough, when I use it in a t

Py.test No module named *

I have a folder structure like this App --App --app.py --Docs --Tests --test_app.py In my test_app.py file, I have a line to import my app module.