Category "pytest"

Mocked values mismatch with MagicMock

I am working on a python project, where we read parquet files from azure datalake and perform the required operations. We have defined a common parquet file rea

pytest-django could not find a Django project

Trying to configure pytest with django, the project already has a lot of test not written with pytest (written with unittest) but I am trying to get them run wi

Returning multiple objects from a pytest fixture

I am learning how to use pytest by testing a simple event emitter implementation. Basically, it looks like this class EventEmitter(): def __init__(self):

pytest skips test because it depends on another test

In my python unit tests, test_B depends on test_A. However, when I run the tests with pytest, it always SKIPS test_B with this message: SKIP [1] /home/shuklas/

AttributeError when using Github self-hosted runners to run unit test

Hello~ I am trying to use Github workflow to run the unit test for the code in my repository. So I wrote a yaml file, its function is when I push my code to my

How to click on QMessageBox with pytest-qt?

I am creating some unit tests for a PyQt application with pytest-qt. And I would like to create open the graphical window, do some tests then close the window,

Cannot import script from repository in pytest using GitHub actions

I am learning to implement automatic testing using GitHub actions. I am trying to solve the following import error. The error is: utils\test_capitalize.py:2: in

pytest run tests inside a class with a constructor

I want to write a test suite for an API. my project tree looks like: project tree I need to have a 'client' file with classes where we initialize all the helpe

Django async testing: Cannot operate on a closed database

I was following this tutorial on testdriven.io in order to test some async functions in django and I need to add som decorators in order to enable my async test

Create dynamic parameters with pytest?

I am attempting to test various endpoints of my REST API. Some of the end points take values that are provided by other end points. For example: Query /locatio

Mocking and testing the python io.BufferedWriter

I'm trying to mock the io.BufferedWrite.write method with @patch using pytest/unittest.mock. The questions arises withing the error cited bellow, saying that th

Testing an electron application through pytest-selenium

I have a small node/electron application to test. It's just run locally with "npm start", which brings up a small electron browser with the application. How can

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