Skip to content

TST: Fix flaky test #27010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions pandas/tests/resample/test_resample_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
end=datetime(2005, 1, 10), freq='Min')

test_series = Series(np.random.rand(len(dti)), dti)
test_frame = DataFrame(
_test_frame = DataFrame(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u just inline this in the fixture?

can u fixturize the series as well

not so sure these are great names either

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixturing this kind of thing is like pulling my own teeth. Closing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i can’t imagine it taking very long

{'A': test_series, 'B': test_series, 'C': np.arange(len(dti))})


@pytest.fixture
def test_frame():
return _test_frame.copy()


def test_str():

r = test_series.resample('H')
Expand Down Expand Up @@ -76,7 +81,7 @@ def test_groupby_resample_on_api():
assert_frame_equal(result, expected)


def test_pipe():
def test_pipe(test_frame):
# GH17905

# series
Expand All @@ -92,7 +97,7 @@ def test_pipe():
tm.assert_frame_equal(result, expected)


def test_getitem():
def test_getitem(test_frame):

r = test_frame.resample('H')
tm.assert_index_equal(r._selected_obj.columns, test_frame.columns)
Expand All @@ -111,7 +116,7 @@ def test_getitem():


@pytest.mark.parametrize('key', [['D'], ['A', 'D']])
def test_select_bad_cols(key):
def test_select_bad_cols(key, test_frame):
g = test_frame.resample('H')
# 'A' should not be referenced as a bad column...
# will have to rethink regex if you change message!
Expand All @@ -120,7 +125,7 @@ def test_select_bad_cols(key):
g[key]


def test_attribute_access():
def test_attribute_access(test_frame):

r = test_frame.resample('H')
tm.assert_series_equal(r.A.sum(), r['A'].sum())
Expand All @@ -143,7 +148,7 @@ def test_api_compat_before_use():
getattr(rs, attr)


def tests_skip_nuisance():
def tests_skip_nuisance(test_frame):

df = test_frame
df['D'] = 'foo'
Expand Down