Skip to content

incremental testsuite: don't write subsequent step files until they are needed #11257

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 2 commits into from
Oct 4, 2021

Conversation

nipunn1313
Copy link
Contributor

Description

This matters with namespace packages enabled - since an (otherwise) empty folder with
some .2 files in it will be considered a namespace package. This is
truer - by only writing the files at the point of the step. This helps
unblock #9636

Test Plan

I confirmed that this helps fix some of the failures in #9636. I confirmed all preexisting tests continue to work.

@@ -638,6 +638,7 @@ import p2.m2
p1/m1.py:1: error: "int" not callable
main.py:2: error: Cannot find implementation or library stub for module named "p2.m2"
main.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
main.py:2: error: Cannot find implementation or library stub for module named "p2"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This now happens because the flags have --namespace-packages for this test! Before, p2 was being found as a namespace package because it contained p2/m2.py.2. This sort of error is happening all over the place in #9636

os.makedirs(dir, exist_ok=True)
with open(path, 'w', encoding='utf8') as f:
f.write(content)
m = re.match(r'.*\.([0-9]+)$', path)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved this stuff so I could combine the re.match logic.
I wonder if we can totally eliminate find_steps and just inject the steps as an arg to suite.run_test()

…re needed

This matters with namespace packages - since an empty package with
some .2 files in it will be considered a namespace package. This is
truer - by only writing the files at the point of the step. This helps
unblock python#9636
Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Excellent!

@hauntsaninja hauntsaninja merged commit 8749901 into python:master Oct 4, 2021
@nipunn1313 nipunn1313 deleted the incremental branch October 4, 2021 17:11
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