-
Notifications
You must be signed in to change notification settings - Fork 261
markers: recognize empty python_version
markers
#849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,6 +171,22 @@ def test_single_marker_intersect() -> None: | |
assert str(intersection) == 'python_version >= "3.4" and python_version < "3.6"' | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("marker1", "marker2"), | ||
[ | ||
('sys_platform == "win32"', 'sys_platform == "linux"'), | ||
('sys_platform != "win32"', 'sys_platform == "win32"'), | ||
('python_version >= "3.6"', 'python_version < "3.6"'), | ||
('python_version == "3.6"', 'python_version == "3.7"'), | ||
('python_version > "3.6"', 'python_version <= "3.6"'), | ||
('python_version >= "3.6"', 'python_version < "3.6"'), | ||
('python_version > "3.6"', 'python_version < "3.7"'), | ||
], | ||
) | ||
def test_single_marker_intersect_is_empty(marker1: str, marker2: str) -> None: | ||
assert parse_marker(marker1).intersect(parse_marker(marker2)).is_empty() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("marker1", "marker2", "expected"), | ||
[ | ||
|
@@ -852,11 +868,6 @@ def test_multi_marker_union_multi_is_multi( | |
'python_version >= "3.6" and python_version < "3.8"', | ||
'python_version >= "3.6" and python_version < "3.8"', | ||
), | ||
( | ||
'python_version > "3.6" and python_full_version < "3.6.2"', | ||
'python_version > "3.6" and python_version < "3.7"', | ||
'python_version > "3.6" and python_version < "3.7"', | ||
), | ||
Comment on lines
-855
to
-859
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test does not make sense because both markers are empty. Similar (but correct) tests are above and below. |
||
( | ||
'python_version > "3.6" and python_full_version < "3.7.2"', | ||
'python_version > "3.6" and python_version < "3.8"', | ||
|
@@ -2260,16 +2271,16 @@ def test_intersection_no_endless_recursion() -> None: | |
' and extra != "postgis"' | ||
) | ||
m2 = parse_marker( | ||
'python_version > "3.12" and python_version < "3.13" or extra != "databricks"' | ||
'python_version >= "3.12" and python_version < "3.13" or extra != "databricks"' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original marker is actually empty and does not trigger a potential endless recursion anymore. I checked that the changed marker triggers the recursion error without the fix from #832. |
||
) | ||
expected = ( | ||
'(python_version < "3.9" or extra != "bigquery" and extra != "parquet"' | ||
' and extra != "motherduck" and extra != "athena" and extra != "synapse"' | ||
' and extra != "clickhouse" and extra != "dremio" and extra != "lancedb"' | ||
' and extra != "deltalake" and extra != "pyiceberg")' | ||
' and python_version < "3.13" and extra != "postgres" and extra != "redshift"' | ||
' and extra != "postgis" and (python_version > "3.12"' | ||
' and python_version < "3.13" or extra != "databricks")' | ||
' and extra != "postgis"' | ||
' and (python_version == "3.12" or extra != "databricks")' | ||
) | ||
assert str(m1.intersect(m2)) == expected | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last test is the relevant one but since I did not find such a basic test function that tests for empty single marker intersections, I just added some additional tests.