Trouble with mocking

2024-09-03 Thread Norman Robins via Python-list
I'm somewhat new to mocking for unit tests. I have some code like this: In foo/bar/baz.py I have 2 function I want to mock, one calls the other" def function1_to_mock(): . . . def function2_to_mock(): function1_to_mock() In foo/bar/main.py I import 1 of these and call it" from .baz

Mocking a function in a process started with multiprocessing.Process

2024-08-27 Thread Norman Robins via Python-list
Is it possible to mock out a function in a process started with multiprocessing.Process? AI tells me it is, but I have not gotten it to work. The use case is that I have a server I want to write tests for. I want the tests to start up the server, but I need to mock out the JWT based auth functions