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

WIP: Get rid of assert reinterpretation in rpython tests #4802

Open
wants to merge 17 commits into
base: branch/default
Choose a base branch
from

Conversation

gitlab-importer
Copy link

In GitLab by @rlamy on Jul 22, 2020, 21:44

Assert reinterpretation has long been deprecated in pytest and was removed in version 3.0. This branch allows rpython tests to run with assert rewriting by adding rpython.rlib.objectmodel.assert_(), which behaves like an RPython assert statement but doesn't get rewritten by pytest.

Fixing the test suite is then just a matter of mechanically replacing all asserts in RPython functions defined in test files by this new assert_() function.

@gitlab-importer
Copy link
Author

In GitLab by @arigo on Jul 22, 2020, 23:48

I must be missing something. Are you suggesting replacing all assert statements in all test files with a less readable version? I'm definitely -1 on that...

@gitlab-importer
Copy link
Author

In GitLab by @rlamy on Jul 23, 2020, 00:04

added 5 commits

  • 190ede5c...cb6af5dc - 3 commits from branch branch/default
  • 9dcbea56 - more assert fixes
  • c749af5a - hg merge default

Compare with previous version

@gitlab-importer
Copy link
Author

In GitLab by @arigo on Jul 23, 2020, 09:26

Also, unless I'm missing something, we'd also need to replace most of the asserts inside PyPy. Otherwise we wouldn't be able to run pypy/module/*/test/test_ztranslation. That doesn't seem like a great plan to me.

@gitlab-importer
Copy link
Author

In GitLab by @rlamy on Jul 23, 2020, 15:41

No, it's only for the RPython snippets inside tests. Regular test asserts don't need to change.

@gitlab-importer
Copy link
Author

In GitLab by @rlamy on Jul 23, 2020, 15:44

No, assert rewriting only applies to test files. PyPy code doesn't need to change.

@gitlab-importer
Copy link
Author

In GitLab by @nulano on Jul 23, 2020, 20:29

Starting with PyTest 2.1.0, it seems it is possible to disable assertion rewriting on a file-by-file basis by adding PYTEST_DONT_REWRITE to a module's docstring. Would this approach work/be better?

https://docs.pytest.org/en/latest/assert.html#disabling-assert-rewriting

pytest-dev/pytest@76cede8

@gitlab-importer
Copy link
Author

In GitLab by @rlamy on Jul 24, 2020, 19:18

Doing it file-by-file would be rather annoying, because we'd lose fancy assert reporting in many cases. If we're going that way, we might as well just pass --assert=plain which is a lot less effort for a similar result.

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