Skip to content

TST: Remove unnecessary pytest fixture scopes #49424

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
Nov 1, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions pandas/tests/arithmetic/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
from pandas.core.computation import expressions as expr


@pytest.fixture(
autouse=True, scope="module", params=[0, 1000000], ids=["numexpr", "python"]
)
@pytest.fixture(autouse=True, params=[0, 1000000], ids=["numexpr", "python"])
def switch_numexpr_min_elements(request):
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
Expand Down
4 changes: 1 addition & 3 deletions pandas/tests/frame/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
)


@pytest.fixture(
autouse=True, scope="module", params=[0, 1000000], ids=["numexpr", "python"]
)
@pytest.fixture(autouse=True, params=[0, 1000000], ids=["numexpr", "python"])
def switch_numexpr_min_elements(request):
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_query_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ def test_invalid_type_for_operator_raises(self, parser, engine, op):


class TestDataFrameQueryBacktickQuoting:
@pytest.fixture(scope="class")
@pytest.fixture
def df(self):
"""
Yields a dataframe with strings that may or may not need escaping
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/interval/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import pandas.core.common as com


@pytest.fixture(scope="class", params=[None, "foo"])
@pytest.fixture(params=[None, "foo"])
def name(request):
return request.param

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/interval/test_interval_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pandas.tseries.offsets import Day


@pytest.fixture(scope="class", params=[None, "foo"])
@pytest.fixture(params=[None, "foo"])
def name(request):
return request.param

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/interval/test_interval_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def skipif_32bit(param):
return pytest.param(param, marks=marks)


@pytest.fixture(scope="class", params=["int64", "float64", "uint64"])
@pytest.fixture(params=["int64", "float64", "uint64"])
def dtype(request):
return request.param

Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/io/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def test_same_ordering(datapath):
pytest.param("bs4", marks=[td.skip_if_no("bs4"), td.skip_if_no("html5lib")]),
pytest.param("lxml", marks=td.skip_if_no("lxml")),
],
scope="class",
)
class TestReadHtml:
@pytest.fixture
Expand All @@ -112,7 +111,7 @@ def spam_data(self, datapath):
def banklist_data(self, datapath):
return datapath("io", "data", "html", "banklist.html")

@pytest.fixture(autouse=True, scope="function")
@pytest.fixture(autouse=True)
def set_defaults(self, flavor):
self.read_html = partial(read_html, flavor=flavor)
yield
Expand Down
4 changes: 1 addition & 3 deletions pandas/tests/series/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
from pandas.core.computation import expressions as expr


@pytest.fixture(
autouse=True, scope="module", params=[0, 1000000], ids=["numexpr", "python"]
)
@pytest.fixture(autouse=True, params=[0, 1000000], ids=["numexpr", "python"])
def switch_numexpr_min_elements(request):
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
Expand Down