Describe the bugtest_s1_orbits.py::test_get_orbits_from_slc_ids, a test that uses Mocker, fails for me with an AssertionError that says "call not found". I am not sure if this is a problem with the code or a problem with the test.
To Reproduce
Checkout the dev branch
Run the test RAiDER > test > test_s1_orbits.py > test_get_orbits_from_slc_ids
Raises AssertionError: download_eofs(['20150621T120220'], ['S1A'], save_dir='/tmp/pytest-of-garlic/pytest-5/test_aoi_without_xpts0', force_asf=True) call not found
Expected behavior
Test should pass if RAiDER is behaving correctly. If RAiDER is doing something wrong, then I am not able to tell what from this error.
Desktop
RAiDER git tag:
commit 4c413ad7475ca154638c87e98610571de41cb031 (HEAD -> dev, upstream/dev, upstream/HEAD)
Merge: 5b7ba07 a826e07
Author: Jeremy Maurer <maurer.jeremy@gmail.com>
Date: Fri Jul 5 16:27:39 2024 -0500
Merge pull request #661 from jlmaurer/fix_gnss_download
Bug fixes and unit test updates
OS: 5.15.153.1-microsoft-standard-WSL2 x86_64
Additional context
Full error:
/mnt/g/Garlic/Documents/Code/GitHub/RAiDER/test/test_s1_orbits.py::test_get_orbits_from_slc_ids failed: self = <MagicMock name='download_eofs' id='140665354331408'>
args = (['20150621T120220'], ['S1A'])
kwargs = {'force_asf': True, 'save_dir': '/tmp/pytest-of-garlic/pytest-5/test_aoi_without_xpts0'}
expected = call(['20150621T120220'], ['S1A'], save_dir='/tmp/pytest-of-garlic/pytest-5/test_aoi_without_xpts0', force_asf=True)
cause = None
actual = [call(['20150621T120220'], ['S1A'], save_dir='/mnt/g/Garlic/Documents/Code/GitHub/RAiDER', force_asf=True), call(['20150621T120232'], ['S1A'], save_dir='/mnt/g/Garlic/Documents/Code/GitHub/RAiDER', force_asf=True)]
expected_string = "download_eofs(['20150621T120220'], ['S1A'], save_dir='/tmp/pytest-of-garlic/pytest-5/test_aoi_without_xpts0', force_asf=True)"
def assert_any_call(self, /, *args, **kwargs):
"""assert the mock has been called with the specified arguments.
The assert passes if the mock has *ever* been called, unlike
`assert_called_with` and `assert_called_once_with` that only pass if
the call is the most recent one."""
expected = self._call_matcher(_Call((args, kwargs), two=True))
cause = expected if isinstance(expected, Exception) else None
actual = [self._call_matcher(c) for c in self.call_args_list]
if cause or expected not in _AnyComparer(actual):
expected_string = self._format_mock_call_signature(args, kwargs)
> raise AssertionError(
'%s call not found' % expected_string
) from cause
E AssertionError: download_eofs(['20150621T120220'], ['S1A'], save_dir='/tmp/pytest-of-garlic/pytest-5/test_aoi_without_xpts0', force_asf=True) call not found
/home/garlic/miniforge3/envs/RAiDER/lib/python3.12/unittest/mock.py:1015: AssertionError
During handling of the above exception, another exception occurred:
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fef337242c0>
def test_get_orbits_from_slc_ids(mocker):
side_effect = [
[Path('foo_start.txt'), Path('foo_stop.txt')],
[Path('bar_start.txt'), Path('bar_end.txt'),
Path('fiz_start.txt'), Path('fiz_end')],
]
mocker.patch('eof.download.download_eofs',
side_effect=side_effect[0])
orbit_files = s1_orbits.get_orbits_from_slc_ids(
['S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8']
)
assert orbit_files == side_effect[0]
assert eof.download.download_eofs.call_count == 2
for dt in '20150621T120220 20150621T120232'.split():
> eof.download.download_eofs.assert_any_call(
[dt],
['S1A'],
save_dir=str(Path.cwd()),
force_asf=True
)
E AssertionError: download_eofs(['20150621T120220'], ['S1A'], save_dir='/tmp/pytest-of-garlic/pytest-5/test_aoi_without_xpts0', force_asf=True) call not found
E
E pytest introspection follows:
E
E Args:
E assert (['20150621T120232'], ['S1A']) == (['20150621T120220'], ['S1A'])
E
E At index 0 diff: ['20150621T120232'] != ['20150621T120220']
E Use -v to get more diff
E Kwargs:
E assert {'force_asf':...itHub/RAiDER'} == {'force_asf':...ithout_xpts0'}
E
E Omitting 1 identical items, use -vv to show
E Differing items:
E {'save_dir': '/mnt/g/Garlic/Documents/Code/GitHub/RAiDER'} != {'save_dir': '/tmp/pytest-of-garlic/pytest-5/test_aoi_without_xpts0'}
E Use -v to get more diff
/mnt/g/Garlic/Documents/Code/GitHub/RAiDER/test/test_s1_orbits.py:173: AssertionError
Describe the bug
test_s1_orbits.py::test_get_orbits_from_slc_ids
, a test that uses Mocker, fails for me with an AssertionError that says "call not found". I am not sure if this is a problem with the code or a problem with the test.To Reproduce
RAiDER > test > test_s1_orbits.py > test_get_orbits_from_slc_ids
AssertionError: download_eofs(['20150621T120220'], ['S1A'], save_dir='/tmp/pytest-of-garlic/pytest-5/test_aoi_without_xpts0', force_asf=True) call not found
Expected behavior Test should pass if RAiDER is behaving correctly. If RAiDER is doing something wrong, then I am not able to tell what from this error.
Desktop
RAiDER git tag:
Additional context Full error: