Skip to content

Commit 12c0fe8

Browse files
authored
TST: Added grid and cli test markers (#741)
1 parent 915e168 commit 12c0fe8

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

pytest.ini

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
markers =
33
slow: marks tests as slow (deselect with '-m "not slow"')
44
network: marks tests that need a network connection (deselect with '-m "not network"')
5+
cli: marks tests that need the CLI installed (deselect with '-m "not cli"')
6+
grid: marks tests that need transformation grids (deselect with '-m "not grid"')

test/crs/test_crs.py

+1
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ def test_coordinate_operation_grids():
561561
)
562562

563563

564+
@pytest.mark.grid
564565
def test_coordinate_operation_grids__alternative_grid_name():
565566
cc = CoordinateOperation.from_epsg(1312, True)
566567
assert len(cc.grids) == 1

test/test_cli.py

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
)
1919

2020

21+
@pytest.mark.cli
2122
@PYPROJ_CLI_ENDPONTS
2223
def test_main(input_command, tmpdir):
2324
with tmp_chdir(str(tmpdir)):
@@ -29,6 +30,7 @@ def test_main(input_command, tmpdir):
2930
assert "-v, --verbose Show verbose debugging version information." in output
3031

3132

33+
@pytest.mark.cli
3234
@PYPROJ_CLI_ENDPONTS
3335
@pytest.mark.parametrize("option", ["-v", "--verbose"])
3436
def test_main__verbose(input_command, option, tmpdir):
@@ -46,6 +48,7 @@ def test_main__verbose(input_command, option, tmpdir):
4648
assert "-v, --verbose " not in output
4749

4850

51+
@pytest.mark.cli
4952
@PYPROJ_CLI_ENDPONTS
5053
@pytest.mark.parametrize("option", [["-h"], []])
5154
def test_sync(input_command, option, tmpdir):
@@ -74,6 +77,7 @@ def _check_list_files_header(lines):
7477
assert lines[1].rstrip("\r") == "----------------------------------"
7578

7679

80+
@pytest.mark.cli
7781
@pytest.mark.network
7882
@PYPROJ_CLI_ENDPONTS
7983
def test_sync__source_id__list(input_command, tmpdir):
@@ -96,6 +100,7 @@ def test_sync__source_id__list(input_command, tmpdir):
96100
assert "fr_ign" == line.split("|")[1].strip()
97101

98102

103+
@pytest.mark.cli
99104
@pytest.mark.network
100105
@PYPROJ_CLI_ENDPONTS
101106
def test_sync__area_of_use__list(input_command, tmpdir):
@@ -118,6 +123,7 @@ def test_sync__area_of_use__list(input_command, tmpdir):
118123
assert "France" in line.split("|")[-1]
119124

120125

126+
@pytest.mark.cli
121127
@pytest.mark.network
122128
@PYPROJ_CLI_ENDPONTS
123129
def test_sync__file__list(input_command, tmpdir):
@@ -140,6 +146,7 @@ def test_sync__file__list(input_command, tmpdir):
140146
assert "ntf_r93" in line.split("|")[0]
141147

142148

149+
@pytest.mark.cli
143150
@pytest.mark.network
144151
@PYPROJ_CLI_ENDPONTS
145152
def test_sync__bbox__list(input_command, tmpdir):
@@ -163,6 +170,7 @@ def test_sync__bbox__list(input_command, tmpdir):
163170
assert " | fr_ign | " in output
164171

165172

173+
@pytest.mark.cli
166174
@pytest.mark.network
167175
@PYPROJ_CLI_ENDPONTS
168176
def test_sync__bbox__list__exclude_world_coverage(input_command, tmpdir):
@@ -187,6 +195,7 @@ def test_sync__bbox__list__exclude_world_coverage(input_command, tmpdir):
187195
assert " | fr_ign | " in output
188196

189197

198+
@pytest.mark.cli
190199
@PYPROJ_CLI_ENDPONTS
191200
@pytest.mark.parametrize(
192201
"extra_arg",

test/test_datum.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from test.conftest import grids_available
66

77

8+
@pytest.mark.grid
89
@pytest.mark.parametrize("proj_class", [Proj, CRS])
910
def test_datum(proj_class):
1011
p1 = proj_class(proj="latlong", datum="WGS84")

test/test_transformer.py

+11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def test_tranform_wgs84_to_custom():
3030
assert f"{xx:.3f} {yy:.3f}" == "212.623 4604.975"
3131

3232

33+
@pytest.mark.grid
3334
def test_transform_wgs84_to_alaska():
3435
with pytest.warns(FutureWarning):
3536
lat_lon_proj = pyproj.Proj(init="epsg:4326", preserve_units=False)
@@ -497,6 +498,7 @@ def test_repr(from_crs, to_crs, expected_repr):
497498
assert repr(Transformer.from_crs(from_crs, to_crs)) == expected_repr
498499

499500

501+
@pytest.mark.grid
500502
def test_repr__conditional():
501503
trans_repr = repr(Transformer.from_crs(4326, 26917))
502504
if grids_available(
@@ -608,6 +610,7 @@ def test_transformer_group():
608610
assert trans_group.best_available
609611

610612

613+
@pytest.mark.grid
611614
def test_transformer_group__unavailable():
612615
trans_group = TransformerGroup(4326, 2964)
613616
for transformer in trans_group.transformers:
@@ -649,6 +652,7 @@ def test_transformer_group__unavailable():
649652
assert not trans_group.best_available
650653

651654

655+
@pytest.mark.grid
652656
def test_transform_group__missing_best():
653657
with pytest.warns(FutureWarning):
654658
lat_lon_proj = pyproj.Proj(init="epsg:4326", preserve_units=False)
@@ -675,6 +679,7 @@ def test_transform_group__missing_best():
675679
assert "ntv2_0" in trans_group.transformers[0].definition
676680

677681

682+
@pytest.mark.grid
678683
def test_transform_group__area_of_interest():
679684
if not grids_available("ca_nrc_ntv2_0.tif"):
680685
with pytest.warns(
@@ -707,6 +712,7 @@ def test_transform_group__area_of_interest():
707712
)
708713

709714

715+
@pytest.mark.grid
710716
def test_transformer_group__get_transform_crs():
711717
tg = TransformerGroup("epsg:4258", "epsg:7415")
712718
if not grids_available("nl_nsgi_rdtrans2018.tif"):
@@ -715,6 +721,7 @@ def test_transformer_group__get_transform_crs():
715721
assert len(tg.transformers) == 2
716722

717723

724+
@pytest.mark.grid
718725
def test_transformer__area_of_interest():
719726
transformer = Transformer.from_crs(
720727
4326, 2964, area_of_interest=AreaOfInterest(-136.46, 49.0, -60.72, 83.17)
@@ -729,6 +736,7 @@ def test_transformer__area_of_interest():
729736
)
730737

731738

739+
@pytest.mark.grid
732740
def test_transformer_proj__area_of_interest():
733741
transformer = Transformer.from_proj(
734742
4326, 2964, area_of_interest=AreaOfInterest(-136.46, 49.0, -60.72, 83.17)
@@ -870,6 +878,7 @@ def test_transformer_group__network_enabled():
870878
assert grid.available
871879

872880

881+
@pytest.mark.grid
873882
@patch.dict("os.environ", {"PROJ_NETWORK": "ON"}, clear=True)
874883
def test_transformer_group__network_disabled():
875884
with proj_network_env():
@@ -970,6 +979,7 @@ def test_transform_honours_input_types(x, y, z):
970979
assert transformer.transform(xx=x, yy=y, zz=z) == (x, y, z)
971980

972981

982+
@pytest.mark.grid
973983
@pytest.mark.network
974984
@patch("pyproj.transformer.get_user_data_dir")
975985
def test_transformer_group__download_grids(get_user_data_dir_mock, tmp_path, capsys):
@@ -1016,6 +1026,7 @@ def test_transformer_group__download_grids(get_user_data_dir_mock, tmp_path, cap
10161026
download_mock.assert_not_called()
10171027

10181028

1029+
@pytest.mark.grid
10191030
@patch("pyproj.transformer._download_resource_file")
10201031
@patch("pyproj.transformer.get_user_data_dir")
10211032
def test_transformer_group__download_grids__directory(

0 commit comments

Comments
 (0)