aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg_resources/__init__.py4
-rw-r--r--pkg_resources/api_tests.txt28
-rw-r--r--pkg_resources/tests/test_resources.py2
3 files changed, 17 insertions, 17 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index b0b04579..286c03ed 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -1410,10 +1410,10 @@ def evaluate_marker(text, extra=None):
This implementation uses the 'pyparsing' module.
"""
- marker = packaging.markers.Marker(text)
try:
+ marker = packaging.markers.Marker(text)
return marker.evaluate()
- except packaging.marker.InvalidMarker as e:
+ except packaging.markers.InvalidMarker as e:
raise SyntaxError(e)
diff --git a/pkg_resources/api_tests.txt b/pkg_resources/api_tests.txt
index 9df56b4b..4fbd3d23 100644
--- a/pkg_resources/api_tests.txt
+++ b/pkg_resources/api_tests.txt
@@ -338,49 +338,49 @@ Environment Markers
>>> import os
>>> print(im("sys_platform"))
- Invalid marker: 'sys_platform'
+ Invalid marker: 'sys_platform', parse error at ''
>>> print(im("sys_platform=="))
- Invalid marker: 'sys_platform=='
+ Invalid marker: 'sys_platform==', parse error at ''
>>> print(im("sys_platform=='win32'"))
False
>>> print(im("sys=='x'"))
- Invalid marker: "sys=='x'"
+ Invalid marker: "sys=='x'", parse error at "sys=='x'"
>>> print(im("(extra)"))
- Invalid marker: '(extra)'
+ Invalid marker: '(extra)', parse error at ')'
>>> print(im("(extra"))
- Invalid marker: '(extra'
+ Invalid marker: '(extra', parse error at ''
>>> print(im("os.open('foo')=='y'"))
- Invalid marker: "os.open('foo')=='y'"
+ Invalid marker: "os.open('foo')=='y'", parse error at 'os.open('
>>> print(im("'x'=='y' and os.open('foo')=='y'")) # no short-circuit!
- Invalid marker: "'x'=='y' and os.open('foo')=='y'"
+ Invalid marker: "'x'=='y' and os.open('foo')=='y'", parse error at 'and os.o'
>>> print(im("'x'=='x' or os.open('foo')=='y'")) # no short-circuit!
- Invalid marker: "'x'=='x' or os.open('foo')=='y'"
+ Invalid marker: "'x'=='x' or os.open('foo')=='y'", parse error at 'or os.op'
>>> print(im("'x' < 'y' < 'z'"))
- Invalid marker: "'x' < 'y' < 'z'"
+ Invalid marker: "'x' < 'y' < 'z'", parse error at "< 'z'"
>>> print(im("r'x'=='x'"))
- Invalid marker: "r'x'=='x'"
+ Invalid marker: "r'x'=='x'", parse error at "r'x'=='x"
>>> print(im("'''x'''=='x'"))
- Invalid marker: "'''x'''=='x'"
+ Invalid marker: "'''x'''=='x'", parse error at "'x'''=='"
>>> print(im('"""x"""=="x"'))
- Invalid marker: '"""x"""=="x"'
+ Invalid marker: '"""x"""=="x"', parse error at '"x"""=="'
>>> print(im(r"x\n=='x'"))
- Invalid marker: "x\\n=='x'"
+ Invalid marker: "x\\n=='x'", parse error at "x\\n=='x'"
>>> print(im("os.open=='y'"))
- Invalid marker: "os.open=='y'"
+ Invalid marker: "os.open=='y'", parse error at 'os.open='
>>> em("sys_platform=='win32'") == (sys.platform=='win32')
True
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 4241765a..8066753b 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -383,7 +383,7 @@ class TestRequirements:
r2 = Requirement.parse("Twisted[bar,FOO]>=1.2")
assert r1 == r2
assert r1.extras == ("foo","bar")
- assert r2.extras == ("bar","foo") # extras are normalized
+ assert r2.extras == ("foo","bar")
assert hash(r1) == hash(r2)
assert (
hash(r1)