Skip to main content
1 vote
1 answer
117 views

Sometimes when I develop by TDD (Test Driven Development) I need to test the calling order of some class methods. In general I write Python code so I'll show the last test case that I have just ...
User051209's user avatar
  • 2,658
-1 votes
1 answer
39 views

I have come across this problem when making my unit tests. from unittest.mock import AsyncMock, patch import pydantic # class Parent(): # Using non-pydantic class works class Parent(pydantic....
Automatico's user avatar
  • 12.9k
0 votes
1 answer
80 views

I have the following directory structure when I use the test runner I get File "/home/kyle/dev/tests/test_foo.py", line 2, in <module> import foo ModuleNotFoundError: No module named ...
user1604008's user avatar
  • 1,179
1 vote
1 answer
62 views

I have a Model class with a series of constraints that I am attempting to test, and I am unable to get these constraints to return an IntegrityError in testing. The class is as follows: from django.db ...
dabo_tusev's user avatar
1 vote
0 answers
63 views

We have several modules that require mandatory feature / backout flags. These flags are defined at module level. module.py: from enabled import is_enabled FLAGS = {flag : is_enabled(flag) for flag in ...
OM222O's user avatar
  • 1,003
-1 votes
1 answer
85 views

Closely related to my question is VSCode: how to interrupt a running Python test?, however in my case the standard method of pressing the square in the Test Results tap does not work. What is ...
Daraan's user avatar
  • 5,166
1 vote
0 answers
86 views

I'm building a backend system using FastAPI, and I'm currently working on implementing unit tests for the password reset functionality that involves using tokens. Here’s the snippet of the code I'm ...
Hiroshi Ashikaga's user avatar
0 votes
1 answer
75 views

I have a configuration module, config with data config.data where I want to add a value for testing. Ideally, I want to use mock.patch.dict as a context manager because the value is a class attribute ...
KSS's user avatar
  • 179
4 votes
1 answer
407 views

I have been working on yet another API using FastAPI and trying to write test cases for the APIs, but facing error that event loop is closed. My setup: So, I am using asyncpg driver/library to connect ...
Super Ultra Noob's user avatar
1 vote
0 answers
90 views

I tend to alwasy run the testers from inside the module folder, but this breaks the "resources.files" functionality, as it seems not to be able to find the module any more module folder ...
hewi's user avatar
  • 1,446
1 vote
2 answers
50 views

I know how to use coverage module to get "human readable" coverage output (using popular third party coverage module). This can be used with pytest or unittest (with some differences in the ...
Amit's user avatar
  • 2,138
1 vote
1 answer
64 views

I have a custom class in the file MyClass.py class MyClass: def __init__(self): self.fetched_data = False def get_data(self): self.fetched_data = True ...
DwightFromTheOffice's user avatar
0 votes
2 answers
61 views

I'm writing because I have a big problem. Well, I have a project in Django where I am using django-tenants. Unfortunately, I can't run any tests as these end up with the following error when calling ...
Draqun's user avatar
  • 364
1 vote
1 answer
188 views

I want to mock asyncio.sleep to shorten the delay, e.g. by a factor of 10, to speed up my tests while also trying to surface any possible race conditions or other bugs as a crude sanity check. However ...
Joe C.'s user avatar
  • 501
2 votes
1 answer
44 views

We can check if a unittest.mock.Mock has any call with some specified arguments. I now want to test that some of the arguments are correct, while I do not know about the other ones. Is there some ...
502E532E's user avatar
  • 581

15 30 50 per page
1
2 3 4 5
241