Category "pytest"

How to mark individual parameterized tests with a marker?

I have been trying to parameterize my tests using @pytest.mark.parametrize, and I have a marketer @pytest.mark.test("1234"), I use the value from the test marke

Pytest-cov with Moto in list_stacks() from Boto3

I'm trying to create a test with pytest and moto that check if the StackStatus from the dictionary returned from the function list_stacks() (https://boto3.amaz

Why can't pytest-django find manage.py?

I have a project structure like this: setup.cfg integration_tests/ |----tests.py src/ |----manage.py |----my_django_app/ And a setup.cfg with this: [t

Test function with lru_cache decorator

I'm attempting to test a a method that is memoized through lru_cache (since it's an expensive database call). with pytest-mock. A simplified version of the cod

Create jira ticket with error message from failed test in PyTest

I have a piece of code that generates a report and adds a screenshot to it when test fails: def pytest_runtest_makereport(item): pytest_html = item.config.plugi

assert_called_with always picking up the arguments from the last call

I am very new to python and this is probably something trivial. I have the following test: import pytest from pytest_mock import MockerFixture, call # Create e

Pytest select tests based on mark.parameterize value?

I see from here that I can pick out tests based on their mark like so: pytest -v -m webtest Let's say I have a test decorated like so: @pytest.mark.parametr

Pytest - Extract data generated by test run to a file/ fixture in conftest?

I am using Pytest framwork for testing a web applications. While the tests run, it generates data and store them into variables. Example: @pytest.mark.usefixt

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