Skip to content

fix: replace . with _ in regex substitution, as naming changed in… #336

fix: replace . with _ in regex substitution, as naming changed in…

fix: replace . with _ in regex substitution, as naming changed in… #336

GitHub Actions / Test Results (3.10) failed Jan 22, 2025 in 0s

20 passed, 4 failed and 0 skipped

Tests failed

❌ test-results.xml

24 tests were completed in 13s with 20 passed, 4 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 20✅ 4❌ 13s

❌ pytest

tests.test_appUtils
  ✅ test_get_packet_from_apid_errors_on_invalid_apid
  ✅ test_convert_to_datetime_on_invalid_datetime
tests.test_database
  ✅ test_database_output_manager_writes_to_database
  ✅ test_database_output_manager_errors_when_destination_file_is_not_found
  ✅ test_database_output_manager_errors_destination_file_different_hash
  ✅ test_database_output_manager_errors_database_error
tests.test_fetchBinary
  ❌ test_fetch_binary_empty_download_not_added_to_output
	mock_poda = <MagicMock spec_set='IWebPODA' id='140268516932096'>
  ❌ test_fetch_binary_with_same_start_end_date
	mock_poda = <MagicMock spec_set='IWebPODA' id='140268516706432'>
tests.test_fetchScience
  ❌ test_fetch_science_no_matching_files
	mock_soc = <MagicMock spec_set='ISDCDataAccess' id='140268516541440'>
  ❌ test_fetch_science_with_same_start_end_date
	mock_soc = <MagicMock spec_set='ISDCDataAccess' id='140268516542496'>
tests.test_main
  ✅ test_app_says_hello
  ✅ test_process_with_valid_config_does_not_error
  ✅ test_process_with_binary_hk_converts_to_csv
  ✅ test_fetch_binary_downloads_hk_from_webpoda
  ✅ test_fetch_science_downloads_cdf_from_sdc
  ✅ test_calibration_creates_calibration_file
  ✅ test_application_creates_L2_file
tests.test_outputManager
  ✅ test_copy_new_file
  ✅ test_copy_file_same_content
  ✅ test_copy_file_existing_versions
  ✅ test_copy_file_forced_version
  ✅ test_copy_file_custom_providers
tests.test_sdcDataAccess
  ✅ test_sdc_data_access_constructor_sets_config
  ✅ test_get_file_path_builds_file_path

Annotations

Check failure on line 0 in test-results.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results (3.10)

pytest ► tests.test_fetchBinary ► test_fetch_binary_empty_download_not_added_to_output

Failed test found in:
  test-results.xml
Error:
  mock_poda = <MagicMock spec_set='IWebPODA' id='140268516932096'>
Raw output
mock_poda = <MagicMock spec_set='IWebPODA' id='140268516932096'>
mock_output_manager = <MagicMock spec_set='IOutputManager' id='140268516923264'>

    def test_fetch_binary_empty_download_not_added_to_output(
        mock_poda: mock.Mock, mock_output_manager: mock.Mock
    ) -> None:
        # Set up.
        fetchBinary = FetchBinary(mock_poda, mock_output_manager)
    
        test_file = Path(tempfile.gettempdir()) / "test_file"
        mock_poda.download.side_effect = lambda **_: create_test_file(test_file, None)
    
        # Exercise.
        actual_downloaded: list[Path] = fetchBinary.download_binaries(
            packet="MAG_HSK_PW",
            start_date=datetime(2025, 5, 2),
            end_date=datetime(2025, 5, 2),
        )
    
        # Verify.
        mock_poda.download.assert_called_once_with(
            packet="MAG_HSK_PW",
            start_date=datetime(2025, 5, 2),
            end_date=datetime(2025, 5, 3),
        )
    
>       mock_output_manager.add_default_file.assert_not_called()

tests/test_fetchBinary.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock spec_set='IOutputManager' id='140268516923264'>
name = 'add_default_file'

    def __getattr__(self, name):
        if name in {'_mock_methods', '_mock_unsafe'}:
            raise AttributeError(name)
        elif self._mock_methods is not None:
            if name not in self._mock_methods or name in _all_magics:
>               raise AttributeError("Mock object has no attribute %r" % name)
E               AttributeError: Mock object has no attribute 'add_default_file'. Did you mean: 'add_default_format_file'?

/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/mock.py:643: AttributeError

Check failure on line 0 in test-results.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results (3.10)

pytest ► tests.test_fetchBinary ► test_fetch_binary_with_same_start_end_date

Failed test found in:
  test-results.xml
Error:
  mock_poda = <MagicMock spec_set='IWebPODA' id='140268516706432'>
Raw output
mock_poda = <MagicMock spec_set='IWebPODA' id='140268516706432'>
mock_output_manager = <MagicMock spec_set='IOutputManager' id='140268516704704'>

    def test_fetch_binary_with_same_start_end_date(
        mock_poda: mock.Mock, mock_output_manager: mock.Mock
    ) -> None:
        # Set up.
        fetchBinary = FetchBinary(mock_poda, mock_output_manager)
    
        test_file = Path(tempfile.gettempdir()) / "test_file"
        mock_poda.download.side_effect = lambda **_: create_test_file(test_file, "content")
    
        # Exercise.
        actual_downloaded: list[Path] = fetchBinary.download_binaries(
            packet="MAG_HSK_PW",
            start_date=datetime(2025, 5, 2),
            end_date=datetime(2025, 5, 2),
        )
    
        # Verify.
        mock_poda.download.assert_called_once_with(
            packet="MAG_HSK_PW",
            start_date=datetime(2025, 5, 2),
            end_date=datetime(2025, 5, 3),
        )
    
>       mock_output_manager.add_default_file.assert_called_once_with(
            test_file,
            descriptor="hsk-pw",
            date=datetime(2025, 5, 2),
            extension="pkts",
        )

tests/test_fetchBinary.py:80: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock spec_set='IOutputManager' id='140268516704704'>
name = 'add_default_file'

    def __getattr__(self, name):
        if name in {'_mock_methods', '_mock_unsafe'}:
            raise AttributeError(name)
        elif self._mock_methods is not None:
            if name not in self._mock_methods or name in _all_magics:
>               raise AttributeError("Mock object has no attribute %r" % name)
E               AttributeError: Mock object has no attribute 'add_default_file'. Did you mean: 'add_default_format_file'?

/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/mock.py:643: AttributeError

Check failure on line 0 in test-results.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results (3.10)

pytest ► tests.test_fetchScience ► test_fetch_science_no_matching_files

Failed test found in:
  test-results.xml
Error:
  mock_soc = <MagicMock spec_set='ISDCDataAccess' id='140268516541440'>
Raw output
mock_soc = <MagicMock spec_set='ISDCDataAccess' id='140268516541440'>
mock_output_manager = <MagicMock spec_set='IOutputManager' id='140268516712864'>

    def test_fetch_science_no_matching_files(
        mock_soc: mock.Mock, mock_output_manager: mock.Mock
    ) -> None:
        # Set up.
        fetchScience = FetchScience(
            mock_soc, mock_output_manager, modes=[MAGMode.Normal], sensors=[MAGSensor.OBS]
        )
    
        mock_soc.get_filename.side_effect = lambda **_: {}  # return empty dictionary
    
        # Exercise.
        actual_downloaded: list[Path] = fetchScience.download_latest_science(
            level="l1b",
            start_date=datetime(2025, 5, 2),
            end_date=datetime(2025, 5, 2),
        )
    
        # Verify.
        mock_soc.get_filename.assert_called_once_with(
            level="l1b",
            descriptor="norm-mago",
            start_date=datetime(2025, 5, 2),
            end_date=datetime(2025, 5, 2),
            version="latest",
            extension="cdf",
        )
    
        mock_soc.download.assert_not_called()
>       mock_output_manager.add_default_file.assert_not_called()

tests/test_fetchScience.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock spec_set='IOutputManager' id='140268516712864'>
name = 'add_default_file'

    def __getattr__(self, name):
        if name in {'_mock_methods', '_mock_unsafe'}:
            raise AttributeError(name)
        elif self._mock_methods is not None:
            if name not in self._mock_methods or name in _all_magics:
>               raise AttributeError("Mock object has no attribute %r" % name)
E               AttributeError: Mock object has no attribute 'add_default_file'. Did you mean: 'add_default_format_file'?

/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/mock.py:643: AttributeError

Check failure on line 0 in test-results.xml

See this annotation in the file changed.

@github-actions github-actions / Test Results (3.10)

pytest ► tests.test_fetchScience ► test_fetch_science_with_same_start_end_date

Failed test found in:
  test-results.xml
Error:
  mock_soc = <MagicMock spec_set='ISDCDataAccess' id='140268516542496'>
Raw output
mock_soc = <MagicMock spec_set='ISDCDataAccess' id='140268516542496'>
mock_output_manager = <MagicMock spec_set='IOutputManager' id='140268515010896'>

    def test_fetch_science_with_same_start_end_date(
        mock_soc: mock.Mock, mock_output_manager: mock.Mock
    ) -> None:
        # Set up.
        fetchScience = FetchScience(
            mock_soc, mock_output_manager, modes=[MAGMode.Normal], sensors=[MAGSensor.OBS]
        )
    
        test_file = Path(tempfile.gettempdir()) / "test_file"
    
        mock_soc.get_filename.side_effect = lambda **_: [
            {
                "file_path": test_file.absolute(),
                "descriptor": "norm-mago",
            }
        ]
        mock_soc.download.side_effect = lambda file_path: file_path
    
        # Exercise.
        actual_downloaded: list[Path] = fetchScience.download_latest_science(
            level="l1b",
            start_date=datetime(2025, 5, 2),
            end_date=datetime(2025, 5, 2),
        )
    
        # Verify.
        mock_soc.get_filename.assert_called_once_with(
            level="l1b",
            descriptor="norm-mago",
            start_date=datetime(2025, 5, 2),
            end_date=datetime(2025, 5, 2),
            version="latest",
            extension="cdf",
        )
        mock_soc.download.assert_called_once_with(
            test_file.absolute(),
        )
    
>       mock_output_manager.add_default_file.assert_called_once_with(
            test_file,
            level="l1b",
            descriptor="norm-mago",
            date=datetime(2025, 5, 2),
            extension="cdf",
        )

tests/test_fetchScience.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock spec_set='IOutputManager' id='140268515010896'>
name = 'add_default_file'

    def __getattr__(self, name):
        if name in {'_mock_methods', '_mock_unsafe'}:
            raise AttributeError(name)
        elif self._mock_methods is not None:
            if name not in self._mock_methods or name in _all_magics:
>               raise AttributeError("Mock object has no attribute %r" % name)
E               AttributeError: Mock object has no attribute 'add_default_file'. Did you mean: 'add_default_format_file'?

/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/mock.py:643: AttributeError