Skip to content

Commit a43c74f

Browse files
committed
Fix up tests that rely on extras
1 parent 907f574 commit a43c74f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/integration/test_unit_conversion.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def test_convert_unit_unknown_mapping_type():
9494
),
9595
)
9696
def test_convert_unit_single_unit(unit, exp_unit, only_two_index_levels_df):
97+
pytest.importorskip("pint")
98+
9799
start = create_test_df(
98100
variables=[
99101
("Cold", "mK"),
@@ -170,6 +172,8 @@ def test_convert_unit_ur_injection():
170172

171173
@check_auto_index_casting_df
172174
def test_convert_unit_mapping(only_two_index_levels_df):
175+
pytest.importorskip("pint")
176+
173177
start = create_test_df(
174178
variables=[
175179
("temperature", "K"),
@@ -210,6 +214,8 @@ def test_convert_unit_mapping(only_two_index_levels_df):
210214

211215
@check_auto_index_casting_df
212216
def test_convert_series(only_two_index_levels_df):
217+
pytest.importorskip("pint")
218+
213219
# Check that conversion works if user supplies a Series of target units
214220
start = create_test_df(
215221
variables=[
@@ -255,6 +261,8 @@ def test_convert_series(only_two_index_levels_df):
255261

256262
@check_auto_index_casting_df
257263
def test_convert_series_all_rows(only_two_index_levels_df):
264+
pytest.importorskip("pint")
265+
258266
start = create_test_df(
259267
variables=[
260268
("temperature", "K"),
@@ -297,6 +305,8 @@ def test_convert_series_all_rows(only_two_index_levels_df):
297305

298306
@check_auto_index_casting_df
299307
def test_convert_series_extra_rows(only_two_index_levels_df):
308+
pytest.importorskip("pint")
309+
300310
start = create_test_df(
301311
variables=[
302312
("temperature", "K"),
@@ -387,6 +397,8 @@ def test_convert_unit_like(
387397
only_two_index_levels_df,
388398
only_two_index_levels_target,
389399
):
400+
pytest.importorskip("pint")
401+
390402
create_kwargs = dict(
391403
n_scenarios=2,
392404
n_runs=3,
@@ -433,6 +445,8 @@ def test_convert_unit_like_missing_levels(
433445
only_two_index_levels_df,
434446
only_two_index_levels_target,
435447
):
448+
pytest.importorskip("pint")
449+
436450
start = create_test_df(
437451
variables=[
438452
("Cold", "mK"),
@@ -478,6 +492,8 @@ def test_convert_unit_like_missing_specs(
478492
"""
479493
Test conversion when the target doesn't specify a unit for all rows in start
480494
"""
495+
pytest.importorskip("pint")
496+
481497
start = create_test_df(
482498
variables=[
483499
("Cold", "mK"),
@@ -520,6 +536,8 @@ def test_convert_unit_like_extra_levels_ok(
520536
only_two_index_levels_df,
521537
only_two_index_levels_target,
522538
):
539+
pytest.importorskip("pint")
540+
523541
start = create_test_df(
524542
variables=[
525543
("Cold", "mK"),
@@ -618,6 +636,8 @@ def test_convert_unit_like_extra_specs(
618636
"""
619637
Test conversion when the target has a unit for rows that aren't in start
620638
"""
639+
pytest.importorskip("pint")
640+
621641
start = create_test_df(
622642
variables=[
623643
("Cold", "mK"),
@@ -709,6 +729,8 @@ def test_convert_unit_like_ur_injection():
709729
def test_convert_unit_like_unit_level_handling(
710730
df_unit_level, df_unit_level_exp, target_unit_level, target_unit_level_exp
711731
):
732+
pytest.importorskip("pint")
733+
712734
start = create_test_df(
713735
variables=[(f"variable_{i}", "kg") for i in range(2)],
714736
n_scenarios=2,

0 commit comments

Comments
 (0)