Skip to content

Commit c96b112

Browse files
rcap107dierickxsimon
authored andcommitted
FIX - Fixing a condition in conftest for polars w/out pyarrow (skrub-data#1659)
1 parent d3122e7 commit c96b112

12 files changed

Lines changed: 45 additions & 45 deletions

skrub/_dataframe/tests/test_common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import skrub
1919
from skrub import selectors as s
2020
from skrub._dataframe import _common as ns
21-
from skrub.conftest import polars_installed_without_pyarrow
21+
from skrub.conftest import skip_polars_installed_without_pyarrow
2222

2323

2424
def test_not_implemented():
@@ -105,7 +105,7 @@ def test_to_numpy(df_module, example_data_dict):
105105
assert_array_equal(array[2:], np.asarray(example_data_dict["str-col"])[2:])
106106

107107

108-
@polars_installed_without_pyarrow
108+
@skip_polars_installed_without_pyarrow
109109
def test_to_pandas(df_module, pd_module):
110110
with pytest.raises(TypeError):
111111
ns.to_pandas(np.arange(3))
@@ -728,7 +728,7 @@ def test_mean(df_module):
728728
)
729729

730730

731-
@polars_installed_without_pyarrow
731+
@skip_polars_installed_without_pyarrow
732732
def test_corr(df_module):
733733
df = df_module.example_dataframe
734734

skrub/_reporting/tests/test_patch_display.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import pytest
44

55
from skrub import patch_display, unpatch_display
6-
from skrub.conftest import polars_installed_without_pyarrow
6+
from skrub.conftest import skip_polars_installed_without_pyarrow
77

88

99
@pytest.mark.parametrize("repeat_patch", [1, 2])
1010
@pytest.mark.parametrize("repeat_unpatch", [1, 2])
11-
@polars_installed_without_pyarrow
11+
@skip_polars_installed_without_pyarrow
1212
def test_patch_display(df_module, repeat_patch, repeat_unpatch, capsys):
1313
df = df_module.make_dataframe(
1414
dict(

skrub/_reporting/tests/test_summarize.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
from skrub import _dataframe as sbd
1010
from skrub._reporting import _sample_table
1111
from skrub._reporting._summarize import summarize_dataframe
12-
from skrub.conftest import polars_installed_without_pyarrow
12+
from skrub.conftest import skip_polars_installed_without_pyarrow
1313

1414

1515
@pytest.mark.parametrize("order_by", [None, "date.utc", "value"])
1616
@pytest.mark.parametrize("with_plots", [False, True])
1717
@pytest.mark.parametrize("with_associations", [False, True])
18-
@polars_installed_without_pyarrow
18+
@skip_polars_installed_without_pyarrow
1919
def test_summarize(
2020
monkeypatch, df_module, air_quality, order_by, with_plots, with_associations
2121
):
@@ -116,7 +116,7 @@ def test_high_cardinality_column(pd_module):
116116
assert "10 most frequent" in summary["columns"][0]["value_counts_plot"]
117117

118118

119-
@polars_installed_without_pyarrow
119+
@skip_polars_installed_without_pyarrow
120120
def test_all_null(df_module):
121121
df = df_module.make_dataframe(
122122
{
@@ -145,7 +145,7 @@ def make_summary(df_size, **summarize_kwargs):
145145
return make_summary
146146

147147

148-
@polars_installed_without_pyarrow
148+
@skip_polars_installed_without_pyarrow
149149
def test_small_df(small_df_summary):
150150
summary = small_df_summary(11)
151151
thead, first_slice, ellipsis, last_slice = summary["sample_table"]["parts"]
@@ -260,7 +260,7 @@ def test_duplicate_columns(pd_module):
260260
assert cols[1]["mean"] == 3.5
261261

262262

263-
@polars_installed_without_pyarrow
263+
@skip_polars_installed_without_pyarrow
264264
def test_high_cardinality_columns(df_module):
265265
df = df_module.make_dataframe(
266266
{
@@ -274,7 +274,7 @@ def test_high_cardinality_columns(df_module):
274274
assert cols[1]["is_high_cardinality"]
275275

276276

277-
@polars_installed_without_pyarrow
277+
@skip_polars_installed_without_pyarrow
278278
def test_bool_column_mean(df_module):
279279
df = df_module.make_dataframe({"a": [True, False, True, True, False, True]})
280280
summary = summarize_dataframe(df)

skrub/_reporting/tests/test_table_report.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from skrub import TableReport, ToDatetime
1313
from skrub import _dataframe as sbd
1414
from skrub._reporting._sample_table import make_table
15-
from skrub.conftest import polars_installed_without_pyarrow
15+
from skrub.conftest import skip_polars_installed_without_pyarrow
1616

1717

1818
@pytest.fixture
@@ -34,7 +34,7 @@ def get_report_id(html):
3434
return re.search(r'<skrub-table-report.*?id="report_([a-z0-9]+)"', html).group(1)
3535

3636

37-
@polars_installed_without_pyarrow
37+
@skip_polars_installed_without_pyarrow
3838
def test_report(air_quality):
3939
col_filt = {
4040
"first_2": {
@@ -82,13 +82,13 @@ def test_report(air_quality):
8282
assert len(all_report_ids) == len(set(all_report_ids))
8383

8484

85-
@polars_installed_without_pyarrow
85+
@skip_polars_installed_without_pyarrow
8686
def test_few_columns(df_module, check_polars_numpy2):
8787
report = TableReport(df_module.example_dataframe)
8888
assert "First 10 columns" not in report.html()
8989

9090

91-
@polars_installed_without_pyarrow
91+
@skip_polars_installed_without_pyarrow
9292
def test_few_rows(df_module, check_polars_numpy2):
9393
df = sbd.slice(df_module.example_dataframe, 2)
9494
TableReport(df).html()
@@ -104,15 +104,15 @@ def test_open(pd_module, browser_mock):
104104
assert b"the title" in browser_mock.content
105105

106106

107-
@polars_installed_without_pyarrow
107+
@skip_polars_installed_without_pyarrow
108108
def test_non_hashable_values(df_module):
109109
# non-regression test for #1066
110110
df = df_module.make_dataframe(dict(a=[[1, 2, 3], None, [4]]))
111111
html = TableReport(df).html()
112112
assert "[1, 2, 3]" in html
113113

114114

115-
@polars_installed_without_pyarrow
115+
@skip_polars_installed_without_pyarrow
116116
def test_nat(df_module):
117117
# non-regression for:
118118
# https://github.com/skrub-data/skrub/issues/1111
@@ -125,7 +125,7 @@ def test_nat(df_module):
125125
TableReport(df).html()
126126

127127

128-
@polars_installed_without_pyarrow
128+
@skip_polars_installed_without_pyarrow
129129
def test_bool_column_mean(df_module):
130130
df = df_module.make_dataframe({"a": [True, False, True, True, False, True]})
131131
html = TableReport(df).html()
@@ -139,7 +139,7 @@ def test_duplicate_columns(pd_module):
139139
TableReport(df).html()
140140

141141

142-
@polars_installed_without_pyarrow
142+
@skip_polars_installed_without_pyarrow
143143
def test_infinite_values(df_module):
144144
# Non-regression for https://github.com/skrub-data/skrub/issues/1134
145145
# (histogram plot failing with infinite values)
@@ -153,7 +153,7 @@ def test_infinite_values(df_module):
153153
TableReport(df).html()
154154

155155

156-
@polars_installed_without_pyarrow
156+
@skip_polars_installed_without_pyarrow
157157
def test_duration(df_module):
158158
df = df_module.make_dataframe(
159159
{"a": [datetime.timedelta(days=2), datetime.timedelta(days=3)]}
@@ -212,7 +212,7 @@ def test_write_html_with_not_utf8_encoding(tmp_path, pd_module):
212212
assert "</html>" not in saved_content
213213

214214

215-
@polars_installed_without_pyarrow
215+
@skip_polars_installed_without_pyarrow
216216
def test_verbosity_parameter(df_module, capsys):
217217
df = df_module.make_dataframe(
218218
dict(
@@ -235,7 +235,7 @@ def test_verbosity_parameter(df_module, capsys):
235235
assert capsys.readouterr().err != ""
236236

237237

238-
@polars_installed_without_pyarrow
238+
@skip_polars_installed_without_pyarrow
239239
def test_write_to_stderr(df_module, capsys):
240240
df = df_module.make_dataframe(
241241
dict(
@@ -256,7 +256,7 @@ def test_write_to_stderr(df_module, capsys):
256256
assert re.search(pattern, captured.err)
257257

258258

259-
@polars_installed_without_pyarrow
259+
@skip_polars_installed_without_pyarrow
260260
def test_max_plot_columns_parameter(df_module):
261261
df = df_module.make_dataframe(
262262
{f"col_{i}": [i + j for j in range(3)] for i in range(10)}
@@ -316,7 +316,7 @@ def test_error_input_type(simple_df, simple_series):
316316
TableReport(df)
317317

318318

319-
@polars_installed_without_pyarrow
319+
@skip_polars_installed_without_pyarrow
320320
def test_single_column_report(df_module):
321321
# Check that single column report works
322322
single_col = df_module.example_column

skrub/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ def _example_data_dict():
105105
else:
106106
_polars_installed_without_pyarrow = False
107107

108-
polars_installed_without_pyarrow = pytest.mark.skipif(
109-
_polars_installed_without_pyarrow=False,
108+
skip_polars_installed_without_pyarrow = pytest.mark.skipif(
109+
_polars_installed_without_pyarrow,
110110
reason="When polars is installed, requires pyarrow to be installed too",
111111
)
112112

skrub/tests/test_check_input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from skrub import _dataframe as sbd
66
from skrub._check_input import CheckInputDataFrame
7-
from skrub.conftest import polars_installed_without_pyarrow
7+
from skrub.conftest import skip_polars_installed_without_pyarrow
88

99

1010
def test_good_input(df_module):
@@ -39,7 +39,7 @@ def test_input_is_an_array():
3939
check.fit_transform(np.ones((2,)))
4040

4141

42-
@polars_installed_without_pyarrow
42+
@skip_polars_installed_without_pyarrow
4343
def test_wrong_dataframe_library_in_transform():
4444
pl = pytest.importorskip("polars")
4545
df = pl.DataFrame({"a": [0, 1], "b": [10, 20]})

skrub/tests/test_column_associations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
from skrub import _dataframe as sbd
77
from skrub import column_associations
8-
from skrub.conftest import polars_installed_without_pyarrow
8+
from skrub.conftest import skip_polars_installed_without_pyarrow
99

1010

11-
@polars_installed_without_pyarrow
11+
@skip_polars_installed_without_pyarrow
1212
def test_column_associations(df_module):
1313
x = (np.ones((7, 3)) * np.arange(3)).ravel()
1414
y = 2 - 3 * x
@@ -28,7 +28,7 @@ def test_column_associations(df_module):
2828
)
2929

3030

31-
@polars_installed_without_pyarrow
31+
@skip_polars_installed_without_pyarrow
3232
def test_infinite(df_module):
3333
# non-regression test for https://github.com/skrub-data/skrub/issues/1133
3434
# (column associations would raise an exception on low-cardinality float

skrub/tests/test_fuzzy_join.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from skrub import ToDatetime, _join_utils, fuzzy_join
99
from skrub import selectors as s
1010
from skrub._dataframe import _common as ns
11-
from skrub.conftest import polars_installed_without_pyarrow
11+
from skrub.conftest import skip_polars_installed_without_pyarrow
1212

1313

1414
@pytest.mark.parametrize(
@@ -238,7 +238,7 @@ def test_numerical_column(df_module):
238238
assert ns.shape(fj_num3) == (2, n_cols)
239239

240240

241-
@polars_installed_without_pyarrow
241+
@skip_polars_installed_without_pyarrow
242242
def test_datetime_column(df_module):
243243
"""
244244
Testing that ``fuzzy_join`` works with datetime columns.
@@ -294,7 +294,7 @@ def to_dt(lst):
294294
assert ns.shape(fj_time3) == (2, n_cols)
295295

296296

297-
@polars_installed_without_pyarrow
297+
@skip_polars_installed_without_pyarrow
298298
def test_mixed_joins(df_module):
299299
"""
300300
Test fuzzy joining on mixed and multiple column types.

skrub/tests/test_join_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from skrub import _dataframe as sbd
88
from skrub import _join_utils
9-
from skrub.conftest import polars_installed_without_pyarrow
9+
from skrub.conftest import skip_polars_installed_without_pyarrow
1010

1111

1212
@pytest.mark.parametrize(
@@ -174,7 +174,7 @@ def test_left_join_wrong_right_type(df_module, left):
174174
)
175175

176176

177-
@polars_installed_without_pyarrow
177+
@skip_polars_installed_without_pyarrow
178178
def test_left_join_types_not_equal(df_module, left):
179179
try:
180180
import polars as pl

skrub/tests/test_to_datetime.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
_get_time_zone,
1717
to_datetime,
1818
)
19-
from skrub.conftest import polars_installed_without_pyarrow
19+
from skrub.conftest import skip_polars_installed_without_pyarrow
2020

2121
ISO = "%Y-%m-%dT%H:%M:%S"
2222

@@ -45,7 +45,7 @@ def datetime_col(df_module):
4545
return sbd.col(df_module.example_dataframe, "datetime-col")
4646

4747

48-
@polars_installed_without_pyarrow
48+
@skip_polars_installed_without_pyarrow
4949
@pytest.mark.parametrize(
5050
"format",
5151
[
@@ -87,7 +87,7 @@ def test_datetime_to_datetime(datetime_col):
8787
assert encoder.format_ is None
8888

8989

90-
@polars_installed_without_pyarrow
90+
@skip_polars_installed_without_pyarrow
9191
def test_rejected_columns(df_module):
9292
with pytest.raises(ValueError, match=".*does not contain strings"):
9393
ToDatetime().fit_transform(sbd.col(df_module.example_dataframe, "float-col"))
@@ -99,7 +99,7 @@ def test_rejected_columns(df_module):
9999
)
100100

101101

102-
@polars_installed_without_pyarrow
102+
@skip_polars_installed_without_pyarrow
103103
def test_transform_failures(datetime_col, df_module):
104104
encoder = ToDatetime().fit(strftime(datetime_col, ISO))
105105
test_col = df_module.make_column(
@@ -110,7 +110,7 @@ def test_transform_failures(datetime_col, df_module):
110110
assert sbd.to_list(sbd.fill_nulls(strftime(transformed, ISO), "????")) == expected
111111

112112

113-
@polars_installed_without_pyarrow
113+
@skip_polars_installed_without_pyarrow
114114
def test_mixed_offsets(df_module):
115115
s = df_module.make_column(
116116
"when", ["2020-01-02T08:00:01+02:00", "2020-01-02T08:00:01+04:00"]

0 commit comments

Comments
 (0)