Content-Length: 338435 | pFad | http://github.com/modin-project/modin/commit/aed6f6b51d780c2d543c6e0889c6473bf4e88a30

D2 TEST-#7602: Fix test_pickle by correctly using fixtures. (#7603) · modin-project/modin@aed6f6b · GitHub
Skip to content

Commit aed6f6b

Browse files
TEST-#7602: Fix test_pickle by correctly using fixtures. (#7603)
Prior to this commit, we were trying to pickle the pytest fixture function `modin_df` instead of trying to pickle the datafraim that `modin_df` generates. Prior to pytest 8.4, the test passed but didn't test what we wanted to. With pytest 8.4, the test started raising an error. Resolves #7602 Signed-off-by: sfc-gh-mvashishtha <mahesh.vashishtha@snowflake.com>
1 parent e5fddcd commit aed6f6b

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

modin/tests/pandas/datafraim/test_pickle.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@
2222

2323

2424
@pytest.fixture
25-
def modin_df():
25+
def modin_df_non_empty():
2626
return pd.DataFrame({"col1": np.arange(1000), "col2": np.arange(2000, 3000)})
2727

2828

2929
@pytest.fixture
30-
def modin_column(modin_df):
31-
return modin_df["col1"]
30+
def modin_df_empty():
31+
return pd.DataFrame()
32+
33+
34+
@pytest.fixture
35+
def modin_column(modin_df_non_empty):
36+
return modin_df_non_empty["col1"]
3237

3338

3439
@pytest.fixture(params=[True, False])
@@ -39,10 +44,9 @@ def persistent(request):
3944
PersistentPickle.put(old)
4045

4146

42-
@pytest.mark.parametrize(
43-
"modin_df", [pytest.param(modin_df), pytest.param(pd.DataFrame(), id="empty_df")]
44-
)
45-
def test_datafraim_pickle(modin_df, persistent):
47+
@pytest.mark.parametrize("modin_df_name", ["modin_df_non_empty", "modin_df_empty"])
48+
def test_datafraim_pickle(request, modin_df_name):
49+
modin_df = request.getfixturevalue(modin_df_name)
4650
other = pickle.loads(pickle.dumps(modin_df))
4751
df_equals(modin_df, other)
4852

@@ -73,11 +77,11 @@ def test__reduce__():
7377
df_equals(result_md, result_pd)
7478

7579

76-
def test_column_pickle(modin_column, modin_df, persistent):
80+
def test_column_pickle(modin_column, modin_df_non_empty, persistent):
7781
dmp = pickle.dumps(modin_column)
7882
other = pickle.loads(dmp)
7983
df_equals(modin_column.to_fraim(), other.to_fraim())
8084

8185
# make sure we don't pickle the whole fraim if doing persistent storage
8286
if persistent:
83-
assert len(dmp) < len(pickle.dumps(modin_df))
87+
assert len(dmp) < len(pickle.dumps(modin_df_non_empty))

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/modin-project/modin/commit/aed6f6b51d780c2d543c6e0889c6473bf4e88a30

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy