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

Add Test To Verify Rewritten *.pyc Files Are Readable #9522

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

holmanb
Copy link
Contributor

@holmanb holmanb commented Jan 18, 2022

Additional test verifies that rewrite->compile->write->read results in a valid pyc file.

closes #9521

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.

Thanks!

Out of curiosity, why do you say it was not covered before?

@holmanb
Copy link
Contributor Author

holmanb commented Jan 19, 2022

Out of curiosity, why do you say it was not covered before?

I suppose that was misleading wording, apologies. I see that tests exist for _read_pyc(), _write_pyc(), and _rewrite_test() (which is called in exec_module()). What I don't see are any tests that verify that a pyc written with _write_pyc() is actually valid and readable with _read_pyc(). This "covers" that case. If this is already tested in some other way that I haven't considered I can drop this PR.

@holmanb holmanb changed the title Add test coverage to test rewrite Add Test To Verify Rewritten *.pyc Files Are Readable Jan 19, 2022
@nicoddemus
Copy link
Member

No that's fine, thanks for the clarification! I think such a test is valuable to have. 👍

@nicoddemus nicoddemus merged commit 4c8fb6f into pytest-dev:main Jan 20, 2022
nicoddemus added a commit to nicoddemus/pytest that referenced this pull request Jan 20, 2022
@nicoddemus
Copy link
Member

Backport: #9530

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.

Add test coverage to pyc rewrite code
2 participants