with patch('sap_extractor.extractor.run') as run_mock:
run_mock.return_value = Mock()
extractor.main()
When I try to execute it got stuck not going forward and neither it’s fail or pass. I feel something I miss or did mistake in mocking the objects. Please help me to resolve it.
Thanks in Advance Harshita
Best answer by Nimesha
Hi Harshita,
In the provided test, you’ve mocked the following paths;
mock_abspath.return_value = '/path/to/yaml_file.yaml' mock_dirname.side_effect = lambda x: x
Ensure that the mock paths match the expected path in the main function. If your BASE_DIRis not '/path/to/', you should adjust the mocked paths accordingly.
It seems like your test is stuck due to a deadlock or infinite loop in your code or the test itself. Could you please simplify the test structure as show below?
from unittest.mock import patch, Mock from sap_extractor import extractor
In the provided test, you’ve mocked the following paths;
mock_abspath.return_value = '/path/to/yaml_file.yaml' mock_dirname.side_effect = lambda x: x
Ensure that the mock paths match the expected path in the main function. If your BASE_DIRis not '/path/to/', you should adjust the mocked paths accordingly.
Hi Community! if there is someone here who can provide assistance on the above from @Harshita Sai we would greatly appreciate it. Your collective knowledge and experience make this community a valuable resource, so if you know how to help out here, we’d love to hear from you 🏅
Wanted to check in with you regarding the post you made a while back. We haven’t seen any updates, so I’m reaching out to see if everything has been resolved or if you still need assistance.