Skip to main content

All Questions

Tagged with
1 vote
2 answers
65 views

How to mock sqlalchemy's async session?

Code snippet from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine engine = create_async_engine(url="") session_maker = async_sessionmaker(engine) How can I mock the ...
Michael Xia's user avatar
0 votes
0 answers
28 views

How to list all futures that are being polled inside specific event loop when running pytest?

I'm running multiple pytest tests. I have 1 specific test case, which works fine when executed alone, but when large amount of previous tests are being executed, this particular test gets stuck when ...
Grzegorz Limanówka's user avatar
0 votes
1 answer
33 views

AssertionError while testing forms.py in Django

I tried to test forms.py in Django which has LeadForm class. Here, is the models.py class Lead(TimestampedModel): """leads for LIVE courses""" course = models....
Keerthana Baskar's user avatar
0 votes
0 answers
23 views

testing django oauth2_provider authentication endpoint

I need to test o/token endpoint of the oauth2_provider. I wrote the test in pytest. I think I considered every thing but I get invalid_client error. The code: factory: class UserApplicationFactory(...
Mosy Mosy's user avatar
2 votes
0 answers
29 views

Changing the scope of a pytest fixture to a larger one for a single module

I have a pytest fixture defined in conftest.py that looks like this: @pytest.fixture(scope="function") def setup_multiple(create, delete): @contextlib.contextmanager def f(type, num=...
eilchner's user avatar
  • 121
0 votes
1 answer
33 views

@pytest.mark.parametrize for function that returns two values

I have a function that takes a pandas DataFrame (it is important that this specific DataFrame, that goes as an argument into the function, has no column names) and produces a DataFrame with column ...
Meronam's user avatar
0 votes
0 answers
29 views

How to test a CLI app with Typer and Questionary?

I have created a CLI app using Typer in Python. Among other things, it should be possible to create new records. For querying the individual properties, I have used the Questionary package. The CLI ...
sghgw's user avatar
  • 93
0 votes
1 answer
79 views

Use multiple AsyncClients with Pytest for Integration testing

I want to use two different httpx clients one which interacts with the actual database and other which interact with test database. But for some reason all the transactions happen on the actual ...
Misto Shiawase's user avatar
0 votes
0 answers
36 views

pytest how to implementation a plugin to execute by every directory

My project struct like . ├── test_dir_1 │   ├── conftest.py │   ├── test_case_1.py │   └── test_case_3.py └── test_dir_2 ├── conftest.py └── test_case_2.py conftest: import pytest from loguru import ...
aka00's user avatar
  • 1
1 vote
1 answer
84 views

Pytest monkeypatch a multiprocess function for testing

Pytest monkeypatching a function that uses multiprocess (via concurrent.futures.ProcessPoolExecutor) does not work as expected. If the same function is written with a single process or multithread (...
Kacper's user avatar
  • 23
0 votes
1 answer
59 views

pytest fixtures in nested Classes

I have written the following testcase using pytest. import pytest data_arg = ["arg1", "arg2"] class TestParentClass1: @pytest.fixture(scope="class", params=data_arg,...
Shreyansh Jain's user avatar
0 votes
1 answer
21 views

Can I get access to a pytest hook to inject my logic AFTER the junit XML results file has been created?

From reading the docs I see that the latest hook after a test class has completed is pytest_runtest_logfinish. However, when I implement that hook and use the debugger, I see that the XML file (...
Leggy's user avatar
  • 155
0 votes
0 answers
23 views

Mock or stub a QEvent?

Is there a way to mock a QEvent and pass it as a parameter? I have a test like this which I want to include: def test_table_resize_event_sets_column_widths(): table = results_table_classes....
mike rodent's user avatar
  • 15.1k
1 vote
1 answer
49 views

Increasing test coverage for files I didn't write

I have written a python program that calculates various statistical values of a given list of integers and the range of values. Now, I am trying to write a test file for the program that can achieve &...
Austin's user avatar
  • 51
1 vote
0 answers
30 views

How to use multiple API modules in a single testing file?

Disclaimer: first Stack Overflow post, and very new to pytest. I'm a part of a very new QA team in the company. Right now we are focusing on creating initial tests for various Sync APIs (most of them ...
Ariel Agranovich's user avatar

15 30 50 per page
1
2 3 4 5
44