Skip to content Skip to sidebar Skip to footer
Showing posts with the label Unit Testing

How To Mock A Socket Object Via The Mock Library

How to mock a TCPSocket wrapper for the socket from the Python's standard libary via the mock l… Read more How To Mock A Socket Object Via The Mock Library

How To Properly Unit Test Filenotfounderror

With the unittest module, how can I test FileNotFoundError is raised when opening a file as follows… Read more How To Properly Unit Test Filenotfounderror

How To Organize Python Test In A Way That I Can Run All Tests In A Single Command?

Currently my code is organized in the following tree structure: src/ module1.py module2.py … Read more How To Organize Python Test In A Way That I Can Run All Tests In A Single Command?

Double Parameterization

So I have a set of tests where I'd like to test multiple versions of a solution. Currently I ha… Read more Double Parameterization

How To Unit Test Time Based Functions Without Adding Parameters

I created a function that returns seconds left until the next occurrence of that time, but I came a… Read more How To Unit Test Time Based Functions Without Adding Parameters

Run Python Unit Test With Python 2.7 And 3.x

I run my python unit tests by executing my test file through the shell and invoking if __name__ == … Read more Run Python Unit Test With Python 2.7 And 3.x

Running Unit Tests In Parallel With Pytest?

How can I parallelize the execution of the unit tests written with pytest? Which tactics of paralle… Read more Running Unit Tests In Parallel With Pytest?

Pytest : Cannot Mock __init__ Of My Class

I am having a custom Db class, which has the basic operations. I am trying to write tests around it… Read more Pytest : Cannot Mock __init__ Of My Class