Skip to content
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

marker union is non-deterministic in ordering #5721

Closed
dimbleby opened this issue May 30, 2022 · 1 comment
Closed

marker union is non-deterministic in ordering #5721

dimbleby opened this issue May 30, 2022 · 1 comment
Labels
kind/bug Something isn't working as expected

Comments

@dimbleby
Copy link
Contributor

dimbleby commented May 30, 2022

def test_consistent_order() -> None:
    m1 = parse_marker(
        'python_version >= "3.6" and python_version < "3.7" and python_full_version <'
        ' "3.6.2"'
    )
    m2 = parse_marker(
        'python_full_version >= "3.6.2" and python_full_version < "4.0.0" and'
        ' python_version >= "3.6" and python_version < "3.7"'
    )
    union = m1.union(m2)
    assert (
        str(union)
        == 'python_version >= "3.6" and python_version < "3.7" and python_full_version'
        ' < "4.0.0"'
    )

sometimes passes, sometimes fails.

(This testcase assumes python-poetry/poetry-core#382)

This makes it a right pain to try and write unit tests, if nothing else...

I think that the indeterminacy is introduced at MultiMarker.union_simplify(), which puts markers into a set; but iteration order on that set seems to be arbitrary.

@dimbleby dimbleby added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels May 30, 2022
@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Jun 11, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants