Skip to content

Tag: python-unittest

Unittesting python?

I have some function with api I have some integration tests: Please could you show how Unittest will look like relatively mine function . Answer Solution Use unittest.mock module. More details can be found here. Explanation patch replaces a real object or function with a mock one. It requires a positional arg…

Using unittests and moto to mock AWS

I am used to pytest approach for unit testing, without using classes. Today I wanted to give a try to unittest and I wanted to encapsulate my tests inside a TestCase. Then consider this sample test class: Why is not the parameter placed in setUpClass visible from the test? I could imagine that by using the @m…