Closed avalentino closed 2 years ago
$ python3 -m pytest ======================================================== test session starts ======================================================== platform linux -- Python 3.9.9, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 rootdir: /home/antonio/projects/forks/sentineleof collected 5 items eof/tests/test_eof.py ....F [100%] ============================================================= FAILURES ============================================================== _______________________________________________________ TestEOF.test_mission ________________________________________________________ self = <eof.tests.test_eof.TestEOF testMethod=test_mission>, download_eofs = <MagicMock name='download_eofs' id='139942478821984'> @mock.patch("eof.download.download_eofs") def test_mission(self, download_eofs): download.main(mission="S1A", date="20200101") > download_eofs.assert_called_once_with( missions=["S1A"], orbit_dts=["20200101"], sentinel_file=None, save_dir=",", use_scihub=True, ) eof/tests/test_eof.py:157: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../anaconda3/envs/p39cf/lib/python3.9/unittest/mock.py:919: in assert_called_once_with return self.assert_called_with(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <MagicMock name='download_eofs' id='139942478821984'>, args = () kwargs = {'missions': ['S1A'], 'orbit_dts': ['20200101'], 'save_dir': ',', 'sentinel_file': None, ...} expected = call(missions=['S1A'], orbit_dts=['20200101'], sentinel_file=None, save_dir=',', use_scihub=True) actual = call(orbit_dts=['20200101'], missions=['S1A'], sentinel_file=None, save_dir=',', orbit_type='precise') _error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f46e6883160>, cause = None def assert_called_with(self, /, *args, **kwargs): """assert that the last call was made with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.""" if self.call_args is None: expected = self._format_mock_call_signature(args, kwargs) actual = 'not called.' error_message = ('expected call not found.\nExpected: %s\nActual: %s' % (expected, actual)) raise AssertionError(error_message) def _error_message(): msg = self._format_mock_failure_message(args, kwargs) return msg expected = self._call_matcher(_Call((args, kwargs), two=True)) actual = self._call_matcher(self.call_args) if actual != expected: cause = expected if isinstance(expected, Exception) else None > raise AssertionError(_error_message()) from cause E AssertionError: expected call not found. E Expected: download_eofs(missions=['S1A'], orbit_dts=['20200101'], sentinel_file=None, save_dir=',', use_scihub=True) E Actual: download_eofs(orbit_dts=['20200101'], missions=['S1A'], sentinel_file=None, save_dir=',', orbit_type='precise') ../../../anaconda3/envs/p39cf/lib/python3.9/unittest/mock.py:907: AssertionError ====================================================== short test summary info ====================================================== FAILED eof/tests/test_eof.py::TestEOF::test_mission - AssertionError: expected call not found. ==================================================== 1 failed, 4 passed in 0.47s ====================================================