I see this error when running Setuptools' tests on Python 3.7:
==================================================================================== FAILURES =====================================================================================
_______________________________________________________________________ TestParsing.testSimpleRequirements ________________________________________________________________________
strs = 'x\\'
def parse_requirements(strs):
"""Yield ``Requirement`` objects for each specification in `strs`
`strs` must be a string, or a (possibly-nested) iterable thereof.
"""
# create a steppable iterator, so we can handle \-continuations
lines = iter(yield_lines(strs))
for line in lines:
# Drop comments -- a hash without a space may be in a URL.
if ' #' in line:
line = line[:line.find(' #')]
# If there is a line continuation, drop it, and append the next line.
if line.endswith('\\'):
line = line[:-2].strip()
> line += next(lines)
E StopIteration
pkg_resources/__init__.py:3038: StopIteration
The above exception was the direct cause of the following exception:
self = <pkg_resources.tests.test_resources.TestParsing object at 0x1059e1da0>
def testSimpleRequirements(self):
assert (
list(parse_requirements('Twis-Ted>=1.2-1'))
==
[Requirement('Twis-Ted>=1.2-1')]
)
assert (
list(parse_requirements('Twisted >=1.2, \\ # more\n<2.0'))
==
[Requirement('Twisted>=1.2,<2.0')]
)
assert (
Requirement.parse("FooBar==1.99a3")
==
Requirement("FooBar==1.99a3")
)
with pytest.raises(ValueError):
Requirement.parse(">=2.3")
with pytest.raises(ValueError):
> Requirement.parse("x\\")
pkg_resources/tests/test_resources.py:600:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
s = 'x\\'
@staticmethod
def parse(s):
> req, = parse_requirements(s)
E RuntimeError: generator raised StopIteration
pkg_resources/__init__.py:3092: RuntimeError
The issue is an intentional regression introduced in Python 3.7 as part of PEP 479.
Thanks
Most helpful comment
The issue is an intentional regression introduced in Python 3.7 as part of PEP 479.