Skip to main content

Questions tagged [pytest]

For questions about the pytest Python testing tool. Please also add the [python] tag for questions tagged with [pytest].

0 votes
1 answer
12 views

How to store a response from one test case and use it in another test case in Pytest

Store Response from test_component_approval_request and Use in Another Test Case Description: We need to store the component_id from the response of the test_component_approval_request test case and ...
Abilash's user avatar
  • 49
0 votes
0 answers
11 views

Running pytest playwright script in headed mode from the command line

I am trying to run some script in headed mode from command line but its always running in headless mode. The thing is when I am directly running the class from the pycharm IDE, its successfully ...
Apratim Chaudhuri's user avatar
1 vote
0 answers
8 views

How to quickly find a parametrized tuple in pytest.mark.parametrize related to a certain id

I have a long list of 20+ tuples in pytest.mark.parametrize and an equally long ids corresponding to each tuple. Without having to debug or run the test, how do you identify which tuple goes with ...
user10469929's user avatar
0 votes
0 answers
8 views

Database is locked when acreate operation is handled

I'm writting tests for my project. I tried to add some async things to it. And that things worked but when I run tests it fails: django.db.utils.OperationalError: database is locked await UserBill....
Konstantinos's user avatar
0 votes
0 answers
12 views

Getting "No module named '_pytest'" error when I am trying to execute a pytest fixture

I installed pytest using pip install in my virtual environment and I can see it under site-packages. When I try to execute the test case, it gives me the below error : File "/Users/a768584/...
Tester_Cary's user avatar
0 votes
1 answer
28 views

monkeypatch logging basicConfig with pytest

I have a function that that involves setting up a logger: app/src/app/pipelines.py: import logging def get_log_handlers(filepath): return [logging.FileHandler(filepath, ...
Tim Kirkwood's user avatar
0 votes
0 answers
10 views

switching tabs is not working in selenium-python

I am writing small python script to open a webpage and click a link which redirects to next page. I have to then click export button which downloads the file. When the control goes to second webpage, ...
Sangeetha Gowda's user avatar
0 votes
0 answers
19 views

Being able to stop pytest execution but providing repot when some conditions are reached

I'm in the need of some quite strange use case. I have a bunch of pytest tests running, which are doing their stuff. Some of them are changing an environment. These tests are daily running. And I can ...
Xaruman's user avatar
  • 119
1 vote
0 answers
11 views

Why Tox won't work in pycharm run/debug but works in terminal

I have an issue with pycharm and tox. When im running tox thru pycharm terminal by 'tox', all tests are start running but if i want to use ctrl+shift+R(run button in pycharm), i have an error: ...
Bart77's user avatar
  • 103
1 vote
1 answer
25 views

how do i make pytest run my expecting test?

I'm unable to make a test that handles when the key value name does not exist: if not self.key_vault_name: raise ValueError("Key Vault name is not set in the environment variables.") ...
fabriziocucina's user avatar
1 vote
1 answer
41 views

pytest import errors - module not found

I have this directory structure: app/ pyproject.toml src/ app/ __init__.py app.py functions1.py functions2.py tests/ ...
Tim Kirkwood's user avatar
0 votes
0 answers
22 views

When using a custom Playwright-Python browser context, how to take fail case screenshots using Pytest?

Recently introduced to test automation I have been using Playwright-Python to create tests for our small team's SaaS portal. Code below has been simplified and rewritten using saucedemo. Our use case ...
peyt1212's user avatar
1 vote
1 answer
24 views

How to test Django models against a DB without manage.py in a standalone package using pytest and GitHub Actions?

Context: I am developing a standalone Django package that is intended to be added to existing Django projects. This package includes Django models with methods that interact directly with a database. ...
Alex's user avatar
  • 13
1 vote
1 answer
19 views

How to handle data creation and testing the data in pytest

Pytest says in it's documentation that each test has unique class instance of the class and you can't share the same class between tests. "Having each test share the same class instance would be ...
Beni Keyserman's user avatar
0 votes
0 answers
11 views

Python Unit Test ModuleNotFoundError with local Module

My directory structure is like so: src ├──__init__.py ├──config.py ├──util.py ├──log.py │ └── tests ├── __init__.py └── SomeTest.py When I run SomeTest.py via pipenv run pytest src/tests/...
Justin's user avatar
  • 887

15 30 50 per page
1
2 3 4 5
697