@patch decorator cannot set Provider May 3, 2023 by Tarik Use a string instead of the class. @patch('provider.Provider', autospec=True) def test_init(self, mock_provider): pass