Skip to content

Commit e1c5314

Browse files
committed
Replace 'raise StopIteration' usages in the code by 'return's in accordance to PEP-479
Fix #2160
1 parent 0931fe2 commit e1c5314

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
3.0.7 (unreleased)
2-
=======================
2+
==================
33

44
*
55

6+
* Replace ``raise StopIteration`` usages in the code by simple ``returns`` to finish generators, in accordance to `PEP-479`_ (`#2160`_).
7+
Thanks `@tgoodlet`_ for the report and `@nicoddemus`_ for the PR.
8+
69
*
710

811
*
912

1013
*
1114

15+
.. _#2160: https://github.com/pytest-dev/pytest/issues/2160
16+
17+
.. _PEP-479: https://www.python.org/dev/peps/pep-0479/
18+
1219

1320
3.0.6 (2017-01-22)
1421
==================

_pytest/python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def pytest_pycollect_makeitem(collector, name, obj):
174174
outcome = yield
175175
res = outcome.get_result()
176176
if res is not None:
177-
raise StopIteration
177+
return
178178
# nothing was collected elsewhere, let's do it here
179179
if isclass(obj):
180180
if collector.istestclass(obj, name):

0 commit comments

Comments
 (0)