Skip to content

Commit

Permalink
Sort by name when iterating directories
Browse files Browse the repository at this point in the history
Resolve intermittently failing unit tests with the added bonus of
more stable output.
  • Loading branch information
phyrwork committed Aug 29, 2024
1 parent f766b1f commit 17fbe36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/copyright2/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __iter__(self) -> Iterator[File]:
exclude_dirs=self.cfg.exclude_dirs,
)

for path in self.path.iterdir():
for path in sorted(self.path.iterdir()):
if not filter.match(path):
continue

Expand Down
4 changes: 2 additions & 2 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def test_list_readme(examples_readme: None) -> None:

assert result.stdout.splitlines() == [
"README.md",
"src/readme.py",
"src/ext/readme.h",
"src/ext/readme.c",
"src/ext/readme.h",
"src/readme.py",
"4",
]

Expand Down

0 comments on commit 17fbe36

Please sign in to comment.