def export_esa(): # if the working directory is alread ml_drought don't need ../data if Path('.').absolute().as_posix().split('/')[-1] == 'ml_drought': data_path = Path('data') else: data_path = Path('../data') exporter = ESACCIExporter(data_folder=data_path) exporter.export()
def test_wget_export(self, mock_system, tmp_path, capsys): # checks we don't redownload files exporter = ESACCIExporter(tmp_path) # setup the already downloaded file test_filename = exporter.target_file (tmp_path / f'raw/esa_cci_landcover/{test_filename}').touch() (tmp_path / f'raw/esa_cci_landcover/legend.csv').touch() exporter.export() captured = capsys.readouterr() expected_stdout = 'Data already downloaded!' assert expected_stdout in captured.out, \ f'Expected stdout to be {expected_stdout}, got {captured.out}' mock_system.assert_not_called( ), 'os.system was called! Should have been skipped'
def export_esa(): exporter = ESACCIExporter(data_folder=get_data_path()) exporter.export()