diff --git a/src/hipscat_import/cross_match/macauff_arguments.py b/src/hipscat_import/cross_match/macauff_arguments.py index 53e23553..93f3bca6 100644 --- a/src/hipscat_import/cross_match/macauff_arguments.py +++ b/src/hipscat_import/cross_match/macauff_arguments.py @@ -16,6 +16,7 @@ @dataclass class MacauffArguments(RuntimeArguments): """Data class for holding cross-match association arguments""" + ## Input - Cross-match data input_path: FilePointer | None = None """path to search for the input data""" @@ -102,26 +103,26 @@ def get_column_names(self): # TODO: Actually read in the metadata file once we get the example file from Tom. return [ - 'Gaia_designation', - 'Gaia_RA', - 'Gaia_Dec', - 'BP', - 'G', - 'RP', - 'CatWISE_Name', - 'CatWISE_RA', - 'CatWISE_Dec', - 'W1', - 'W2', - 'match_p', - 'Separation', - 'eta', - 'xi', - 'Gaia_avg_cont', - 'CatWISE_avg_cont', - 'Gaia_cont_f1', - 'Gaia_cont_f10', - 'CatWISE_cont_f1', - 'CatWISE_cont_f10', - 'CatWISE_fit_sig', + "Gaia_designation", + "Gaia_RA", + "Gaia_Dec", + "BP", + "G", + "RP", + "CatWISE_Name", + "CatWISE_RA", + "CatWISE_Dec", + "W1", + "W2", + "match_p", + "Separation", + "eta", + "xi", + "Gaia_avg_cont", + "CatWISE_avg_cont", + "Gaia_cont_f1", + "Gaia_cont_f10", + "CatWISE_cont_f1", + "CatWISE_cont_f10", + "CatWISE_fit_sig", ] diff --git a/src/hipscat_import/cross_match/run_macauff_import.py b/src/hipscat_import/cross_match/run_macauff_import.py index f133c8bc..aad49b51 100644 --- a/src/hipscat_import/cross_match/run_macauff_import.py +++ b/src/hipscat_import/cross_match/run_macauff_import.py @@ -2,6 +2,7 @@ # pylint: disable=unused-argument + def run(args, client): """run macauff cross-match import pipeline""" if not args: diff --git a/tests/hipscat_import/conftest.py b/tests/hipscat_import/conftest.py index d563963c..1d6f2d77 100644 --- a/tests/hipscat_import/conftest.py +++ b/tests/hipscat_import/conftest.py @@ -123,6 +123,7 @@ def formats_pandasindex(test_data_dir): def formats_multiindex(test_data_dir): return os.path.join(test_data_dir, "test_formats", "multiindex.parquet") + @pytest.fixture def formats_yaml(test_data_dir): return os.path.join(test_data_dir, "test_formats", "macauff_metadata.yaml") diff --git a/tests/hipscat_import/cross_match/test_macauff_arguments.py b/tests/hipscat_import/cross_match/test_macauff_arguments.py index c0ab2b49..ab981ae0 100644 --- a/tests/hipscat_import/cross_match/test_macauff_arguments.py +++ b/tests/hipscat_import/cross_match/test_macauff_arguments.py @@ -11,11 +11,7 @@ def test_macauff_arguments( - small_sky_object_catalog, - small_sky_source_catalog, - small_sky_dir, - formats_yaml, - tmp_path + small_sky_object_catalog, small_sky_source_catalog, small_sky_dir, formats_yaml, tmp_path ): """Test that we can create a MacauffArguments instance with two valid catalogs.""" args = MacauffArguments( @@ -37,12 +33,9 @@ def test_macauff_arguments( assert len(args.input_paths) > 0 + def test_empty_required( - small_sky_object_catalog, - small_sky_source_catalog, - small_sky_dir, - formats_yaml, - tmp_path + small_sky_object_catalog, small_sky_source_catalog, small_sky_dir, formats_yaml, tmp_path ): """All non-runtime arguments are required.""" @@ -62,7 +55,7 @@ def test_empty_required( ["right_id_column", "source_id"], ["input_path", small_sky_dir], ["input_format", "csv"], - ["metadata_file_path", formats_yaml] + ["metadata_file_path", formats_yaml], ] ## For each required argument, check that a ValueError is raised that matches the @@ -96,11 +89,7 @@ def test_empty_required( def test_macauff_arguments_file_list( - small_sky_object_catalog, - small_sky_source_catalog, - small_sky_dir, - formats_yaml, - tmp_path + small_sky_object_catalog, small_sky_source_catalog, small_sky_dir, formats_yaml, tmp_path ): """Test that we can create a MacauffArguments instance with two valid catalogs.""" files = [path.join(small_sky_dir, "catalog.csv")] @@ -123,18 +112,14 @@ def test_macauff_arguments_file_list( assert len(args.input_paths) > 0 -def test_macauff_args_invalid_catalog( - small_sky_source_catalog, - small_sky_dir, - formats_yaml, - tmp_path -): + +def test_macauff_args_invalid_catalog(small_sky_source_catalog, small_sky_dir, formats_yaml, tmp_path): with pytest.raises(ValueError, match="left_catalog_dir"): MacauffArguments( output_path=tmp_path, output_catalog_name="object_to_source", tmp_dir=tmp_path, - left_catalog_dir=small_sky_dir, # valid path, but not a catalog + left_catalog_dir=small_sky_dir, # valid path, but not a catalog left_ra_column="ra", left_dec_column="dec", left_id_column="id", @@ -147,12 +132,8 @@ def test_macauff_args_invalid_catalog( metadata_file_path=formats_yaml, ) -def test_macauff_args_right_invalid_catalog( - small_sky_object_catalog, - small_sky_dir, - formats_yaml, - tmp_path -): + +def test_macauff_args_right_invalid_catalog(small_sky_object_catalog, small_sky_dir, formats_yaml, tmp_path): with pytest.raises(ValueError, match="right_catalog_dir"): MacauffArguments( output_path=tmp_path, @@ -162,7 +143,7 @@ def test_macauff_args_right_invalid_catalog( left_ra_column="ra", left_dec_column="dec", left_id_column="id", - right_catalog_dir=small_sky_dir, # valid directory with files, not a catalog + right_catalog_dir=small_sky_dir, # valid directory with files, not a catalog right_ra_column="source_ra", right_dec_column="source_dec", right_id_column="source_id", @@ -171,11 +152,9 @@ def test_macauff_args_right_invalid_catalog( metadata_file_path=formats_yaml, ) + def test_macauff_args_invalid_metadata_file( - small_sky_object_catalog, - small_sky_source_catalog, - small_sky_dir, - tmp_path + small_sky_object_catalog, small_sky_source_catalog, small_sky_dir, tmp_path ): with pytest.raises(ValueError, match="column metadata file must"): MacauffArguments( @@ -195,11 +174,9 @@ def test_macauff_args_invalid_metadata_file( metadata_file_path="ceci_n_est_pas_un_fichier.xml", ) + def test_macauff_args_invalid_input_directory( - small_sky_object_catalog, - small_sky_source_catalog, - formats_yaml, - tmp_path + small_sky_object_catalog, small_sky_source_catalog, formats_yaml, tmp_path ): with pytest.raises(FileNotFoundError, match="input_path not found"): MacauffArguments( @@ -219,12 +196,9 @@ def test_macauff_args_invalid_input_directory( metadata_file_path=formats_yaml, ) + def test_macauff_args_no_files( - small_sky_object_catalog, - small_sky_source_catalog, - small_sky_dir, - formats_yaml, - tmp_path + small_sky_object_catalog, small_sky_source_catalog, small_sky_dir, formats_yaml, tmp_path ): with pytest.raises(FileNotFoundError, match="No input files found"): MacauffArguments( @@ -240,6 +214,6 @@ def test_macauff_args_no_files( right_dec_column="source_dec", right_id_column="source_id", input_path=small_sky_dir, - input_format="parquet", # no files of this format will be found + input_format="parquet", # no files of this format will be found metadata_file_path=formats_yaml, ) diff --git a/tests/hipscat_import/cross_match/test_macauff_runner.py b/tests/hipscat_import/cross_match/test_macauff_runner.py index cac03d29..1431b60d 100644 --- a/tests/hipscat_import/cross_match/test_macauff_runner.py +++ b/tests/hipscat_import/cross_match/test_macauff_runner.py @@ -6,6 +6,8 @@ # pylint: disable=too-many-instance-attributes # pylint: disable=duplicate-code + +@pytest.mark.dask def test_bad_args(dask_client): """Runner should fail with empty or mis-typed arguments""" with pytest.raises(TypeError, match="MacauffArguments"): @@ -16,13 +18,14 @@ def test_bad_args(dask_client): runner.run(args, dask_client) +@pytest.mark.dask def test_no_implementation( - small_sky_object_catalog, - small_sky_source_catalog, - small_sky_dir, - formats_yaml, - tmp_path, - dask_client, + small_sky_object_catalog, + small_sky_source_catalog, + small_sky_dir, + formats_yaml, + tmp_path, + dask_client, ): """Test that we can create a MacauffArguments instance with two valid catalogs.""" args = MacauffArguments(