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

Fix failing test due to unsorted iterdir #1761

Merged
merged 2 commits into from
Oct 21, 2024
Merged

Fix failing test due to unsorted iterdir #1761

merged 2 commits into from
Oct 21, 2024

Conversation

maresb
Copy link
Contributor

@maresb maresb commented Oct 20, 2024

The tests are failing on main with:

         env_dirs = list(storage_path.iterdir())
        assert len(env_dirs) == 2
    
        env_path = env_dirs[1]
    
>       assert env_path.name == 'test'
E       AssertionError: assert 'hatch-build' == 'test'
E         
E         - test
E         + hatch-build

/home/runner/work/hatch/hatch/tests/cli/env/test_create.py:1568: AssertionError

Not sure what triggered this (perhaps something on the runner changed?), and I couldn't reproduce it locally, but the result of list(storage_path.iterdir()) was returning ['test', 'hatch-build'] instead of ['hatch-build', 'test']. Indeed, the docstring of iterdir states:

The children are yielded in arbitrary order

so technically the sort is needed, even if it normally comes out in alphabetical order.

@maresb maresb changed the title Fix failing CI due to unsorted iterdir Fix failing test due to unsorted iterdir Oct 20, 2024
Copy link
Collaborator

@ofek ofek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dude I've been stressing about this in the back of my mind while I haven't had time to investigate, thank you very much!

@ofek ofek merged commit 9650a1d into pypa:master Oct 21, 2024
50 checks passed
@maresb maresb deleted the fix-ci branch October 21, 2024 07:46
@maresb
Copy link
Contributor Author

maresb commented Oct 21, 2024

Very glad to be able to help out! I don't maintain anything nearly as big as hatch, but I still know the feeling. Hope you can take it easy. And of course no pressure on my PRs, whenever you feel like taking a look. Thanks so much for all your efforts!!!

github-actions bot pushed a commit to dhdaines/hatch that referenced this pull request Oct 25, 2024
github-actions bot pushed a commit to paulsuh/hatch that referenced this pull request Oct 29, 2024
github-actions bot pushed a commit to DimitriPapadopoulos/hatch that referenced this pull request Oct 31, 2024
github-actions bot pushed a commit to DylanLukes/hatch that referenced this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants