Skip to content

Commit f07f066

Browse files
committed
test: explicit fixture scope
1 parent 51ef8ae commit f07f066

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/unit/test_pageiterator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from sasctl.core import PageIterator, RestObj
1212

1313

14-
@pytest.fixture(params=[(6, 2, 2), (6, 1, 4), (6, 5, 4), (6, 6, 2), (100, 10, 20)])
14+
@pytest.fixture(scope="function", params=[(6, 2, 2), (6, 1, 4), (6, 5, 4), (6, 6, 2), (100, 10, 20)])
1515
def paging(request):
1616
"""Create a RestObj designed to page through a collection of items and the
1717
collection itself.
@@ -64,20 +64,20 @@ def test_no_paging_required(self):
6464
items = [{"name": "a"}, {"name": "b"}, {"name": "c"}]
6565
obj = RestObj(items=items, count=len(items))
6666

67-
with mock.patch("sasctl.core.request") as request:
67+
with mock.patch("sasctl.core.request") as req:
6868
pager = PageIterator(obj)
6969

7070
# Returned page of items should preserve item order
7171
items = next(pager)
7272
for idx, item in enumerate(items):
7373
assert item.name == RestObj(items[idx]).name
7474

75-
# No request should have been made to retrieve additional data.
75+
# No req should have been made to retrieve additional data.
7676
try:
77-
request.assert_not_called()
77+
req.assert_not_called()
7878
except AssertionError as e:
7979
raise AssertionError(
80-
f"method_calls={request.mock_calls} call_args={request.call_args_list}"
80+
f"method_calls={req.mock_calls} call_args={req.call_args_list}"
8181
)
8282

8383
def test_paging_required(self, paging):

0 commit comments

Comments
 (0)