Kinda new to python unittest mock. I have the following code which mocks a number of functions, then tests and calls main(). The mock items are called from main. However, even though the unitests run successfully the original functions are being called as well. Why is this happening?
@patch('utilities.etl.load')
@patch('utilities.etl.get_joined_data')
@patch('utilities.etl.transform')
@patch('utilities.etl.extract_salary')
@patch('utilities.etl.extract')
@patch('utilities.helper.get_spark_session')
def test_main(self, mock_get_sparksession, mock_extract,
mock_salary, mock_transform,
mock_join, mock_load):
mock_get_sparksession.return_value = self.spark
mock_extract.return_value = self.test_extract
mock_salary.return_value = self.test_salary
mock_transform.return_value = self.test_transform
mock_join.return_value = self.test_join
mock_load.return_value = None
main.main()