File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -558,7 +558,7 @@ def of(cls, *markers: BaseMarker) -> MarkerTypes:
558558 continue
559559
560560 if isinstance (marker , SingleMarker ) and marker .name == "python_version" :
561- intersected = False
561+ included = False
562562 for i , mark in enumerate (markers ):
563563 if (
564564 not isinstance (mark , SingleMarker )
@@ -567,16 +567,18 @@ def of(cls, *markers: BaseMarker) -> MarkerTypes:
567567 ):
568568 continue
569569
570- intersection = mark .constraint .union (marker .constraint )
571- if intersection == mark .constraint :
572- intersected = True
570+ union = mark .constraint .union (marker .constraint )
571+ if union == mark .constraint :
572+ included = True
573573 break
574- elif intersection == marker .constraint :
574+ elif union == marker .constraint :
575575 markers [i ] = marker
576- intersected = True
576+ included = True
577577 break
578+ elif union .is_any ():
579+ return AnyMarker ()
578580
579- if intersected :
581+ if included :
580582 continue
581583
582584 markers .append (marker )
Original file line number Diff line number Diff line change @@ -162,16 +162,13 @@ def test_single_marker_not_in_python_intersection():
162162def test_single_marker_union ():
163163 m = parse_marker ('sys_platform == "darwin"' )
164164
165- intersection = m .union (parse_marker ('implementation_name == "cpython"' ))
166- assert (
167- str (intersection )
168- == 'sys_platform == "darwin" or implementation_name == "cpython"'
169- )
165+ union = m .union (parse_marker ('implementation_name == "cpython"' ))
166+ assert str (union ) == 'sys_platform == "darwin" or implementation_name == "cpython"'
170167
171168 m = parse_marker ('python_version >= "3.4"' )
172169
173- intersection = m .union (parse_marker ('python_version < "3.6"' ))
174- assert str ( intersection ) == 'python_version >= "3.4" or python_version < "3.6"'
170+ union = m .union (parse_marker ('python_version < "3.6"' ))
171+ assert union . is_any ()
175172
176173
177174def test_single_marker_union_compacts_constraints ():
You can’t perform that action at this time.
0 commit comments