Skip to main content

All Questions

1 vote
1 answer
501 views

Python Unit Tests Mocking Imports - Removing Dependencies for CI/CD

I have a project written in python that I would like to create unit tests on. This project has a dependency on a database project which is a sort of abstraction layer to data connections. The issue ...
Simon Nicholls's user avatar
0 votes
2 answers
475 views

What if integration testing makes more sense than unit testing for a certain method?

I don't want to spam you with a ton of code, but please have a quick look at this boiler-plate method: In this scenario let's say I have a ProcessingText.py file (class) that I finished its unit ...
Ahmed Alhallag's user avatar
1 vote
1 answer
801 views

How deep should I mock dependencies in unit tests

Consider the following function: def get_api_status(api_client): response = api_client.get('/status/') return response.content and the test for it: def test_get_api_status(): ...
Qback's user avatar
  • 231
0 votes
1 answer
330 views

How to write a good mock for testing

I code in Python and I'm starting to use the Mock library. Although I've read through all of the documentation, something that I'm finding hard to understand is 'What makes a good mock'. For example,...
Ben's user avatar
  • 165
1 vote
2 answers
2k views

How to populate a private container for unit test?

I have a class that defines a private (well, __container to be exact since it is python) container. I am using the information within said container as part of the logic of what the class does and ...
Sardathrion - against SE abuse's user avatar