Skip to content

Conversation

@bluetech
Copy link
Member

The first commit stops using py.path.local, we only need a very simple subset of it.

The second commit replaces os.listdir() with os.scandir() which is faster and reduces the amount of stat calls. This might help when running on very large directory trees, but mostly eclipsed by other overhead (except maybe on network drives and such...).

bluetech added 2 commits July 25, 2020 00:26
Part of reducing dependency on `py`. Also enables upcoming improvements.

In cases where there are simpler alternatives (in tests), I used those.

What's left are a couple of uses in `_pytest.main` and `_pytest.python`
and they only have modest requirements, so all of the featureful code
from py is not needed.
`os.scandir()`, introduced in Python 3.5, is much faster than
`os.listdir()`. See https://www.python.org/dev/peps/pep-0471/.

It also has a `DirEntry` which can be used to further reduce syscalls in
some cases.
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Good work, thanks!

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