Title: Make tests more PyPy compatible
Type: enhancement Stage: patch review
Components: Tests Versions: Python 3.6, Python 3.4, Python 3.5, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Ronan.Lamy, benjamin.peterson, fijall, martin.panter, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2015-09-15 18:15 by serhiy.storchaka, last changed 2021-03-23 02:16 by terry.reedy.

File name Uploaded Description Edit
pypy_tests_gc_collect-2.7.patch serhiy.storchaka, 2015-09-15 18:15 Just add gc.collect() calls review
pypy_tests-2.7_full.patch serhiy.storchaka, 2015-09-16 07:33 Full difference between 2.7 tests in PyPy and CPython review
Messages (8)
msg250789 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-09-15 18:15
PyPy includes modified Python 2.7 tests for testing compatibility. Some of changes skips tests for features that are not implemented in PyPy or are CPython specific, some reflects differences between error types or messages in CPython and PyPy, some are needed because PyPy doesn't use reference counting, some are workarounds for known PyPy or CPython bugs. The purpose of this issue is to port harmless non PyPy-specific changes. I'll split full patch on several parts for easier review.

The first patch in a series just adds gc.collect() or test.test_support.gc_collect() calls to force calling destructors or freeing memory.
msg250812 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-09-15 23:53
Left some comments. There are a few test cases that I suspect are relying on side effects of garbage collection to perform some other test, and it would be better to rework the test. In the other cases, I agree that actual garbage collection behaviour is being tested, and it makes sense to call gc_collect() or similar.
msg250816 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-09-16 05:22
Thank you for your comments Martin. I need a time to think over them and provide alternative solutions that less depend on garbage collecting. May be Maciej can answer questions about causes of some PyPy changes.
msg250824 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-09-16 07:33
Just for reference here is a full difference between 2.7 tests in PyPy and CPython. It makes tests fail in CPython and skips some tests or makes them too lenient.
msg250832 - (view) Author: Maciej Fijalkowski (fijall) * (Python committer) Date: 2015-09-16 08:54

I can answer precise questions, which tests are you asking about?

Note that if the point is to unify the test suite, would be cool to make changes to both pypy and cpython and not just change cpython one.
msg250835 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-09-16 10:32
Maciej: I put a few questions and comments in the code review. See the <> (also linked next to Serhiy’s first patch).
msg250836 - (view) Author: Maciej Fijalkowski (fijall) * (Python committer) Date: 2015-09-16 10:39

Looking through your comments, yes, maybe those tests or those things require fixing. We at pypy don't have enough will to fight python-dev most of the time, so the usual approach is to do "minimal hack that works" without trying to dwelve into why this or that works that way. Obviously feel free to fix the underlaying issue, we'll be happy to commit it to pypy
msg389367 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-03-23 02:16
With 2.7 EOL, is this still relevant?
Date User Action Args
2021-03-23 02:16:55terry.reedysetnosy: + terry.reedy
messages: + msg389367
2019-09-19 15:27:23Ronan.Lamysetnosy: + Ronan.Lamy
2015-09-16 10:39:14fijallsetmessages: + msg250836
2015-09-16 10:32:20martin.pantersetmessages: + msg250835
2015-09-16 08:54:53fijallsetmessages: + msg250832
2015-09-16 07:33:41serhiy.storchakasetfiles: + pypy_tests-2.7_full.patch

messages: + msg250824
2015-09-16 05:22:32serhiy.storchakasetmessages: + msg250816
2015-09-15 23:53:14martin.pantersetnosy: + martin.panter
messages: + msg250812
2015-09-15 18:15:24serhiy.storchakacreate