Skip to content

Put filelock around PEP 561 tests (fixes #12615) #12857

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

Merged
merged 1 commit into from
May 27, 2022

Conversation

erikkemperman
Copy link
Contributor

@erikkemperman erikkemperman commented May 23, 2022

Description

Fixes #12615

As discussed in the linked issue, this PR would put a filesystem-based lock around the pip install steps of the suite of PEP561 testcases, to address race conditions.

It introduces a test-dependency on tox-dev/py-filelock. I used 3.0.0 as a lower bound, simply because that's what the tox version mentioned in tox.ini specifies as its lower bound. However from the release history it seems that Python 3.6 support was dropped in 3.4.2, hence the second line in the requirements.

I ended up just adding the location of the lock file to .gitignore -- I guess it would be possible to try and remove it after the suite has run, e.g. with atexit.register, but I didn't want to make this complicated.

Test Plan

No new tests, just moved the PEP561 suite from "slow" to "slower" in runtests.py.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@ambv
Copy link
Contributor

ambv commented May 25, 2022

I can confirm this solves the issue on my macOS Monterey M1 laptop.

@JelleZijlstra JelleZijlstra requested a review from emmatyping May 25, 2022 13:17
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

This seem to fix the annoying test flakes. Thanks!

Since the sequential PEP 561 test suite is so slow, it probably makes sense to not run it by default in runtests.py. This can be implemented separately.

@JukkaL JukkaL merged commit 07edc92 into python:master May 27, 2022
@erikkemperman erikkemperman deleted the pep-561-tests-filelock branch May 27, 2022 09:51
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.

tests failing on master (macOS Monterey / py 3.7)
3 participants