Category "pytest"

How can I synchronize and join pytest-xdist workers?

I have a set of pytest tests that I run on multiple remotely-connected (embedded) devices (that do not have pytest on itself). Basically, the tests secure-copy

How to create a parametrized fixture that is dependent on value of another parametrized fixture?

Example: from pytest import fixture, skip @fixture(params=['a', 'b']) def f1(request): yield request.param params = [('a', 1), ('a', 2), ('b', 10), ('b',

How to test a dockerized application in an Azure DevOps (Server) pipeline?

I have a simple python dockerized application whose structure is /src - server.py - test_server.py Dockerfile requirements.txt in which the docker base image

identity test game of life

I'm writing the conway's game code in python. My code is like this: def update_board(board: list[list[int]]) -> list[list[int]]: rows = len(board) co

pytest can't find module for tests

I have a structure like (not exact names) - my_project - app - repo - __init__.py - my_repo.py - services - __init__.py

Azure pipeline can't find the user created python module

I am attempting to run tests from a python module using Azure DevOps. I've got a pipeline build set up to build of a yml file and also using classic editor. I'm

Databricks local test fail with java.lang.NoSuchMethodError: org.apache.hadoop.security.HadoopKerberosName.setRuleMechanism

I have a unit test to databricks code, and I want to run it locally on windows. Unluckily when I run pytest with PyCharm, it throws the following exception: Exc

Pytest cannot find function defined in Lambda Layer

I recently added a Lambda Layer to one of my work projects and while it's been a huge success in almost every way, I'm having issues running my tests now. This

What is the best way to mock disconnect within SQLAlchemy

I write tests for CRUD application and i want to be sure that its behaviour is correct during different scenarios when connection to DB permanently or temporari

PendingRollbackError when accessing test database in FastAPI async test

I'm trying to mimic Django behavior when running tests on FastAPI: I want to create a test database in the beginning of each test, and destroy it in the end. Th

Why is caplog.text empty, even though the function I'm testing is logging?

I'm trying to use pytest to test if my function is logging the expected text, such as addressed this question (the pyunit equivalent would be assertLogs). Foll

Flask-login pytest how to test logout

I am building a test suite for a flask app's auth blueprint. I've successfully built tests for user registering and login in, but I am having some trouble to te

Error testing flask-socketio server emitted events with pytest

I'm building the test suite for a recently deployed webapp. It was built using flask-socketio and uses pytest for the testing suite. The big issue here is the l

How to write pytest for boto3 lambda invoke when it is defined inside a function

I am trying to write pytest to test the following method by mocking the boto3 client. I tried with sample test case. I am not sure if that is right way to do it

python failing __eq__ test

I'm new to python and I'm learning to use pytest. I have a class defined as: class Matrix: def __init__(self, *rows): row_length = len(rows[0])

Pytest: run teardown once for all workers using pytest-xdist

I have a pytest fixture that I need to run only once across all pytest workers. @pytest.fixture(scope="session") @shared # this will call setup once for all pr

ImportError: cannot import name 'ProductDetails' from 'pages.views'

I have written test case for views for details page. Here is below code I have written, When I am running Pytest in terminal it raising these error. My project

Parametrizing with class method, then calling that method with object

(pseudo-code) I have class Node with properties: class Node(WebElement): def __init__(self, element): super().__init__(element) ... @p

How to make qtbot select an item from QComboBox?

I'm trying to develop a simple test application (using pytest) that tests an interface with many PyQt5 components (QLabel, QLineEdit, QCheckBox, QRadioButton an

Bazel and py_test in sandbox - any way to define outputs?

I'm running multiple py_test() configurations on number of projects. Since there's a plenty of them, the default sandboxing mechanism seems convenient - tests d