Showing posts with the label unit-testing

[FIXED] py.test does not find tests under a class

Issue I am trying to create test classes that aren't unittest based. This method under this c…

[FIXED] Python Unit Testing: Automatically Running the Debugger when a test fails

Issue Is there a way to automatically start the debugger at the point at which a unittest fails? …

[FIXED] Is there a multi-process unit testing framework / junit addon?

Issue Imagine two servers (each within an own jvm process) which communicate using some form of me…

[FIXED] Testing with configuration files

Issue my Google-fu has failed me by giving me results I don't understand, so I'm asking her…

[FIXED] What does the "-rN" segment of this code do pytest.main(["-v", "--tb=line", "-rN", __file__])?

Issue I have just started learning pytest and was told to use the following code to launch pytest b…

[FIXED] How to use pytest to assert NO Warning is raised

Issue I want to ensure that no warning at all is raised in one assertion. Could not find any expl…

[FIXED] Pytest, how to use a context manager to allow Mock to be used only for certain code?

Issue I'm trying to use Pytest to test Python code. The code I'm testing isn't a class …

[FIXED] How to properly assert that an exception gets raised in pytest?

Issue Code: # coding=utf-8 import pytest def whatever(): return 9/0 def test_whatever(): …

[FIXED] How to write tests for Pydantic models in FastAPI?

Issue I just started using FastAPI but I do not know how do I write a unit test (using pytest) for …

[FIXED] Python, unit-testing and mocking imports

Issue I am in a project where we are starting refactoring some massive code base. One problem that …

[FIXED] How to write unit tests for python tornado application?

Issue I want to try to write some code following TDD practice. I want to create simple app based on…

[FIXED] API testing: How do I mock/patch a method in one place only?

Issue I am trying to patch/mock a method ( AsyncHTTPClient.fetch ) that is being called in two diff…

[FIXED] Tornado unittesting with tornado.options

Issue I am trying to write unit tests for a Tornado web app and I have trouble on how to properly t…

[FIXED] Why python mock patch doesn't work?

Issue I have two files spike.py class T1(object): def foo(self, afd): return "…

[FIXED] Python: Write unittest for console print

Issue Function foo prints to console. I want to test the console print. How can I achieve this in …

[FIXED] Scrapy Unit Testing

Issue I'd like to implement some unit tests in a Scrapy (screen scraper/web crawler). Since a …

[FIXED] Why does Python unit test on SQLite Database fail when I have all the parameters?

Issue I'm new to python and I'm trying unit testing. Right now I'm trying to test inser…

[FIXED] Getting Python's unittest results in a tearDown() method

Issue Is it possible to get the results of a test (i.e. whether all assertions have passed) in a te…

[FIXED] How to exclude a file from coverage.py?

Issue I use nosetest 's coverage.py plugin. Is it somehow possible to exclude entire files or …