Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
15 views

Calling module from jupyter notebook inside of poetry project reults in 'No module named' error

I'm working on a module with poetry with a directory structure like ./ /my_module (module files) /tests test_thing.py /jupyter demo.ipynb In the test files and jupyter ...
learnvst's user avatar
  • 16k
2 votes
0 answers
9 views

Method `new_page` of `BrowserContext` doesn`t work as expected in `Playwright`

I use playwright with pytest. Here are content of my coftest.py file and file with tests test_keplr.py. For some reason, method new_page works as expected in fixture context_use_args_async, but fails ...
blnk.off's user avatar
0 votes
0 answers
25 views

How to capture call inside a with block?

I have some code with a testcase for it. It works fine. import pysftp from unittest import mock remote_file_name = 'remote_file_name' local_path = 'local/path/to/file' def open_sftp_connection(...
Kashyap's user avatar
  • 16.4k
0 votes
1 answer
20 views

Mocking or monkey patching a slow loading resource that loads on import

I have 1 file which loads a particular resource ( from a file ) that takes a while to load. I have a function in another file which uses that resource by importing it first. When that resource is ...
Sam's user avatar
  • 307
-2 votes
0 answers
9 views

" TypeError: test_multiple_input.<locals>.<lambda>() missing 1 required positional argument: '_' main.py:6: TypeError", and I dont even know why

OK so I am creating Calculator using TDD approach. So I have created a stub which accepts multiple inputs of numbers,stub stops accepting it when I hit "Enter", so for test I am using pytest ...
Avdhut Joshi's user avatar
-4 votes
0 answers
43 views

Why does assert statement applied to float(0) gives an error? [duplicate]

I am writing some tests for my code in Python in which I am using a library called pytest. It generally uses assert statements to evaluate a result. I have this code where I figure out if a given ...
Sunpreet Kochhar's user avatar
0 votes
0 answers
21 views

How to capture Errors from Firefox browser console using Playwright Python

I want to capture console logs from Firefox web browser using Playwright Python and attach the same to Allure Report. I am able to fetch Warnings, Logs, Info and Debug messages from browser console, ...
Divya Andrews's user avatar
0 votes
0 answers
8 views

How do I use grpcio-testing with pytest not unittest

I use pytest so I'm not using unittest or grouping my tests in a TestCase class. All examples of this library I see use it this way: class TestCase(unittest.TestCase): def __init__(self, ...
red888's user avatar
  • 30.5k
0 votes
0 answers
13 views

Flask API Pytest Unit Tests Failing Due to Pyodbc

I’m having some issues with using Pytest. My Flask API uses pyodbc to talk to a MSSQL server db. The API runs in a Docker container and I'm running this on my Mac. I have a unit test for a healthcheck ...
danielschnoll's user avatar
0 votes
1 answer
26 views

pytest-bdd splinter Failed to establish a new connection: [WinError 10061]

I'm trying to set up a pytest-bdd splinter test automation framework. I have three scenarios in a feature file and the related steps definitions in a .py file. In my conftest.py file I'm trying to use ...
On3Pl4te's user avatar
0 votes
1 answer
32 views

automatic cleanup of postgres db after each test

I have sqlalchemy application that talks with a postgres db. I want to do some "integration tests" using testcontainers and trying the various scenarios. just to make things simple, let's ...
Vito De Tullio's user avatar
-2 votes
0 answers
36 views

Why should I use specific imports instead of import * in Python? [duplicate]

I am working on a Python project and currently using the following import statement to bring in all fixtures from my conftest.py file: from backend_tests.conftest import * However, I've read that it ...
Egor's user avatar
  • 1
-2 votes
1 answer
61 views

Need help/understanding test functions with pytest

I need help creating test function that can be executed by pytest. I have created one and it passed but I need to test for each function I created and don't know how to do that. I have tried using ...
user23800117's user avatar
-1 votes
0 answers
21 views

How Pytest resolves imports

Here is my folder structure /root /app __init__.py /main.py /tests test_something.py (from app.main import ...) When I run pytest inside /root or /root/tests, I get the error message &...
Michael Xia's user avatar
0 votes
1 answer
66 views

setup function in class doesn't work as expected while passing parameterized values

I have no idea why modifying the code mentioned here to the following doesn't work? The variables are not accessible inside the tests and setup is being invoked before every test despite the scope ...
yowaf21832's user avatar

15 30 50 per page
1
2 3 4 5
539