Skip to content

Commit 8cc2b10

Browse files
committed
test: add pytest.mark.issue marker
1 parent 7a2b1d9 commit 8cc2b10

25 files changed

Lines changed: 62 additions & 50 deletions

holoviews/tests/conftest.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,34 @@ def pytest_addoption(parser):
2626
default=False,
2727
help=f"Run {marker} related tests",
2828
)
29+
parser.addoption(
30+
"--issue",
31+
action="store",
32+
default=None,
33+
type=int,
34+
help="Only run tests covering the given GitHub issue number",
35+
)
2936

3037

3138
def pytest_configure(config):
3239
for marker in CUSTOM_MARKS:
3340
config.addinivalue_line("markers", f"{marker}: {marker} test marker")
41+
config.addinivalue_line("markers", "issue(id): mark test as covering a specific GitHub issue")
3442

3543

3644
def pytest_collection_modifyitems(config, items):
3745
skipped, selected = [], []
3846
markers = [m for m in CUSTOM_MARKS if config.getoption(f"--{m}")]
3947
empty = not markers
48+
issue = config.getoption("--issue")
4049
for item in items:
41-
if empty and any(m in item.keywords for m in CUSTOM_MARKS):
50+
if issue is not None:
51+
marker = item.get_closest_marker("issue")
52+
if marker and issue in marker.args:
53+
selected.append(item)
54+
else:
55+
skipped.append(item)
56+
elif empty and any(m in item.keywords for m in CUSTOM_MARKS):
4257
skipped.append(item)
4358
elif empty:
4459
selected.append(item)

holoviews/tests/core/data/test_pandasinterface.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ def test_data_with_tz(self):
210210
data = hv.Dataset(df).dimension_values("dates")
211211
np.testing.assert_equal(dates, data)
212212

213+
@pytest.mark.issue(6305)
213214
def test_data_groupby_categorial(self):
214-
# Test for https://github.com/holoviz/holoviews/issues/6305
215215
df = pd.DataFrame({"y": [1, 2], "by": ["A", "B"]})
216216
df["by"] = pd.Categorical(df["by"])
217217
ds = hv.Dataset(df, kdims="index", vdims="y").to(hv.Scatter, groupby="by")
@@ -391,8 +391,8 @@ def test_select_not_in_index(self):
391391
expected = self.df.loc[[2]]
392392
pd.testing.assert_frame_equal(selected.data, expected)
393393

394+
@pytest.mark.issue(6578)
394395
def test_select_index_and_column(self):
395-
# See https://github.com/holoviz/holoviews/issues/6578
396396
frame = pd.DataFrame({"number": [1, 1, 2, 2], "color": ["red", "blue", "red", "blue"]})
397397
index = pd.MultiIndex.from_frame(frame, names=("number", "color"))
398398
df = pd.DataFrame({"cat": list("abab"), "values": range(4)}, index=index)
@@ -457,9 +457,8 @@ def test_dataset_dataset_ht_dtypes(self):
457457
assert ds.interface.dtype(ds, "Weight") == np.dtype(int)
458458
assert ds.interface.dtype(ds, "Height") == np.dtype("float64")
459459

460+
@pytest.mark.issue(6298)
460461
def test_regression_no_auto_index(self):
461-
# https://github.com/holoviz/holoviews/issues/6298
462-
463462
plot = hv.Scatter(self.df, kdims="number")
464463
np.testing.assert_equal(
465464
plot.dimension_values("number"), self.df.index.get_level_values("number")

holoviews/tests/core/data/test_spatialpandas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ def test_sort_by_value(self):
371371
pytest.skip("Not supported")
372372

373373

374+
@pytest.mark.issue(6519)
374375
def test_regression_get_value_array():
375-
# See: https://github.com/holoviz/holoviews/pull/6519
376376
df = pd.DataFrame(
377377
{"Longitude": [0, 1, 2], "Latitude": [0, 1, 2], "Sensor": ["S1", "S2", "S1"]}
378378
)

holoviews/tests/core/test_dimensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def test_name_dimension_repr_params_eval_equality(self):
100100
dim = hv.Dimension("test", label="Test Dimension", unit="m")
101101
assert eval(repr(dim), {"Dimension": hv.Dimension}) == dim
102102

103+
@pytest.mark.issue(5378)
103104
def test_pprint_value_boolean(self):
104-
# https://github.com/holoviz/holoviews/issues/5378
105105
dim = hv.Dimension("test")
106106
assert dim.pprint_value(True) == "True"
107107
assert dim.pprint_value(False) == "False"

holoviews/tests/core/test_layers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def test_overlay_iter(self):
2626
for el, v in zip(overlay, views, strict=True):
2727
assert_element_equal(el, v)
2828

29+
@pytest.mark.issue(5315)
2930
def test_overlay_iterable(self):
30-
# Related to https://github.com/holoviz/holoviews/issues/5315
3131
c1 = hv.Curve([0, 1])
3232
c2 = hv.Curve([10, 20])
3333
hv.Overlay({"a": c1, "b": c2}.values())

holoviews/tests/element/test_selection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def setup_method(self):
2626
def teardown_method(self):
2727
hv.Store.current_backend = self._backend
2828

29+
@pytest.mark.issue(6336)
2930
def test_index_selection_on_id_column(self):
30-
# tests issue in https://github.com/holoviz/holoviews/pull/6336
3131
x, y = np.random.randn(2, 100)
3232
idx = np.arange(100)
3333

holoviews/tests/operation/test_datashader.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,8 +1449,8 @@ def test_rasterize_apply_when_instance_with_line_width(self):
14491449
assert isinstance(overlay, hv.Overlay)
14501450
assert len(overlay) == 2
14511451

1452+
@pytest.mark.issue(6326)
14521453
def test_rasterize_path_empty_string_as_cat_sep(self):
1453-
# https://github.com/holoviz/holoviews/issues/6326
14541454
df = pd.DataFrame(
14551455
{
14561456
"x": [1, 1, np.nan, 3, 3, np.nan],
@@ -1478,8 +1478,8 @@ def test_rasterize_path_empty_string_as_cat_sep(self):
14781478
)
14791479
xr.testing.assert_equal(rasterized.data, expected)
14801480

1481+
@pytest.mark.issue(5127)
14811482
def test_rasterize_curve_with_timezone_aware_datetime(self):
1482-
# Test for https://github.com/holoviz/holoviews/issues/5127
14831483
t = pd.date_range(
14841484
start="2020-01-01 10:00", end="2020-01-01 12:00", freq="h", tz="Asia/Shanghai"
14851485
)
@@ -1679,8 +1679,8 @@ def test_rasterize_overlay_seeds_range_streams():
16791679

16801680

16811681
@pytest.mark.usefixtures("bokeh_backend")
1682+
@pytest.mark.issue(6595)
16821683
def test_selector_single_categorical():
1683-
# Test for https://github.com/holoviz/holoviews/issues/6595
16841684
plot = hv.Points(([0, 1], [0, 1], ["A", "A"]), ["X", "Y"], "C")
16851685
plot = rasterize(plot, aggregator=ds.count_cat("C"), selector=ds.first("X"))
16861686
plot = dynspread(plot)
@@ -2060,8 +2060,8 @@ def test_imagestack_datashader_color_key():
20602060
hv.render(op) # should not error out
20612061

20622062

2063+
@pytest.mark.issue(6154)
20632064
def test_imagestack_datashade_count_cat():
2064-
# Test for https://github.com/holoviz/holoviews/issues/6154
20652065
df = pd.DataFrame({"x": range(3), "y": range(3), "c": range(3)})
20662066
op = datashade(hv.Points(df), aggregator=ds.count_cat("c"))
20672067
hv.render(op) # should not error out
@@ -2074,8 +2074,8 @@ def test_imagestack_dynspread():
20742074
hv.render(op) # should not error out
20752075

20762076

2077+
@pytest.mark.issue(6324)
20772078
def test_datashade_count_cat_no_change_inplace():
2078-
# Test for https://github.com/holoviz/holoviews/issues/6324
20792079
df = pd.DataFrame({"x": range(3), "y": range(3), "c": list(map(str, range(3)))})
20802080
expected_dtype = pd.StringDtype(na_value=np.nan) if PANDAS_GE_3_0_0 else "object"
20812081
assert df["c"].dtype == expected_dtype

holoviews/tests/operation/test_operation.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,8 @@ def test_histogram_narwhals_polars_lazy_groupby(self):
816816

817817
@dd_skip
818818
@pytest.mark.usefixtures("mpl_backend")
819+
@pytest.mark.issue(5111)
819820
def test_histogram_dask_array_mpl(self):
820-
# Regression test for https://github.com/holoviz/holoviews/issues/5111
821821
data = {
822822
"carrier": ["A", "A", "A", "A", "B", "B", "B", "B", "B"],
823823
"depdelay": [127.0, 3.0, -3.0, 19.0, 264.0, -6.0, 1.0, 2.0, 83.0],
@@ -1259,16 +1259,10 @@ def test_invert_dendrogram(self, adjoint_dims):
12591259
assert main1.y_range.factors == main2.y_range.factors[::-1]
12601260
assert main1.x_range.factors == main2.x_range.factors[::-1]
12611261

1262-
@pytest.mark.parametrize(
1263-
"adjoint_dims",
1264-
[
1265-
["cluster"],
1266-
["gene"],
1267-
],
1268-
ids=["right", "top"],
1269-
)
1262+
@pytest.mark.parametrize("adjoint_dims", [["cluster"], ["gene"]], ids=["right", "top"])
1263+
@pytest.mark.issue(6625)
12701264
def test_assure_non_adjoined_axis_is_unchanged_points(self, adjoint_dims):
1271-
# See: https://github.com/holoviz/holoviews/pull/6625#issuecomment-2981268665
1265+
# https://github.com/holoviz/holoviews/pull/6625#issuecomment-2981268665
12721266
plot = hv.Points(self.df2, kdims=["gene", "cluster"])
12731267
main1 = self.bokeh_renderer.get_plot(plot).handles["plot"]
12741268

@@ -1281,8 +1275,8 @@ def test_assure_non_adjoined_axis_is_unchanged_points(self, adjoint_dims):
12811275
case ["gene"]:
12821276
assert main1.y_range.factors == main2.y_range.factors
12831277

1278+
@pytest.mark.issue(6669)
12841279
def test_assure_non_adjoined_axis_is_unchanged_heatmap(self):
1285-
# Follow up to previous test, see
12861280
# https://github.com/holoviz/holoviews/pull/6669#issuecomment-3237153317
12871281
plot = hv.HeatMap(self.ds)
12881282
main1 = self.bokeh_renderer.get_plot(plot).handles["plot"]

holoviews/tests/plotting/bokeh/test_annotationplot.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,8 @@ def test_dynamicmap_overlay_hspans(self):
596596
assert plot_el.handles["y_range"].start == plot_dmap.handles["y_range"].start
597597
assert plot_el.handles["y_range"].end == plot_dmap.handles["y_range"].end
598598

599+
@pytest.mark.issue(6289)
599600
def test_hspans_no_upper_range(self):
600-
# Test for: https://github.com/holoviz/holoviews/issues/6289
601-
602601
dim = hv.Dimension("p", label="prob", range=(0, None))
603602
fig = hv.Curve([(0, 0.6), (1, 0.3), (2, 0.4), (3, 0.45)], kdims="x", vdims=dim)
604603
spans = hv.HSpans([(0, 0.2), (0.4, 0.6)], kdims=["x", dim])

holoviews/tests/plotting/bokeh/test_barplot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ def test_box_whisker_multi_level_sorted_alphanumerically(self):
9797
("10", "B"),
9898
]
9999

100+
@pytest.mark.issue(5850)
100101
def test_bars_multi_level_two_factors_in_overlay(self):
101-
# See: https://github.com/holoviz/holoviews/pull/5850
102102
box = hv.Bars(
103103
(["1", "2", "3"] * 10, ["A", "B"] * 15, np.random.randn(30)),
104104
["Group", "Category"],
@@ -486,15 +486,15 @@ def test_bars_continuous_datetime_duplicates(self):
486486
plot = bokeh_renderer.get_plot(bars)
487487
np.testing.assert_almost_equal(plot.handles["glyph"].width, 69120000.0)
488488

489+
@pytest.mark.issue(6364)
489490
def test_bars_continuous_datetime_timezone_in_overlay(self):
490-
# See: https://github.com/holoviz/holoviews/issues/6364
491491
bars = hv.Bars((pd.date_range("1/1/2000", periods=10, tz="UTC"), np.random.rand(10)))
492492
overlay = hv.Overlay([bars])
493493
plot = bokeh_renderer.get_plot(overlay)
494494
assert isinstance(plot.handles["xaxis"], DatetimeAxis)
495495

496+
@pytest.mark.issue(6288)
496497
def test_bars_continuous_datetime_stacked(self):
497-
# See: https://github.com/holoviz/holoviews/issues/6288
498498
data = pd.DataFrame(
499499
{
500500
"x": pd.to_datetime(
@@ -612,8 +612,8 @@ def test_bar_narrow_non_monotonous_xvals(self):
612612

613613

614614
@pytest.mark.parametrize("stacked", [True, False])
615+
@pytest.mark.issue(6580)
615616
def test_grouped_bars_color(stacked):
616-
# Test for https://github.com/holoviz/holoviews/issues/6580
617617
data = {
618618
"A": ["A1", "A1", "A1", "A1", "A2", "A2", "A2", "A2", "A3", "A3", "A3", "A3"],
619619
"B": ["B1", "B2", "B3", "B4", "B1", "B2", "B3", "B4", "B1", "B2", "B3", "B4"],

0 commit comments

Comments
 (0)