Category "pytest"

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.

How to monkeypatch python's datetime.datetime.now with py.test?

I need to test functions which uses datetime.datetime.now(). What is the easiest way to do this?

Insufficient output from unittest subTest elements under pytest

I'm interested in using unittest's subTest for looping through some very similar tests. I found that, when I run tests written in this way under pytest (or nos

How to test authenticated POST request with Pytest in Django

I want to test an authenticated post request on an API using Pytest. This is what I am doing so far: def test_auth_user_can_create(self, client):

How to pass environment variables to pytest

Before I start executing the tests in my Python project, I read some environment variables and set some variables with these values read. My tests will run on t

How to execute pytest paralelly through xdist plugin?

How can I run my pytests parallely on multiple custom environments ? I have pytest-xdist as well. Not sure if this plugin helps test_test.py @pytest.mark.env(