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

Make tests more PyPy compatible #69317

Open
serhiy-storchaka opened this issue Sep 15, 2015 · 18 comments
Open

Make tests more PyPy compatible #69317

serhiy-storchaka opened this issue Sep 15, 2015 · 18 comments
Assignees
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 25130
Nosy @terryjreedy, @cfbolz, @benjaminp, @ambv, @vadmium, @serhiy-storchaka, @rlamy, @miss-islington
PRs
  • bpo-25130: Add calls of gc.collect() in tests to support PyPy #28005
  • bpo-25130: Make unit-test about restricting the maximum number of nested blocks cpython-only #28002
  • [3.10] bpo-25130: Make unit-test about restricting the maximum number of nested blocks cpython-only (GH-28002) #28016
  • [3.9] bpo-25130: Make unit-test about restricting the maximum number … #28017
  • bpo-25130: Make SQLite tests more compatible with PyPy #28021
  • [3.10] bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021) #28022
  • [3.9] bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021) #28023
  • [3.10] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005). #28027
  • [3.9] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005). #28028
  • Files
  • pypy_tests_gc_collect-2.7.patch: Just add gc.collect() calls
  • pypy_tests-2.7_full.patch: Full difference between 2.7 tests in PyPy and CPython
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = None
    created_at = <Date 2015-09-15.18:15:24.258>
    labels = ['type-feature', 'tests', '3.9', '3.10', '3.11']
    title = 'Make tests more PyPy compatible'
    updated_at = <Date 2021-09-08.15:09:06.833>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2021-09-08.15:09:06.833>
    actor = 'lukasz.langa'
    assignee = 'serhiy.storchaka'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests']
    creation = <Date 2015-09-15.18:15:24.258>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['40475', '40481']
    hgrepos = []
    issue_num = 25130
    keywords = ['patch']
    message_count = 18.0
    messages = ['250789', '250812', '250816', '250824', '250832', '250835', '250836', '389367', '400439', '400492', '400496', '400497', '400519', '400520', '400522', '400523', '400526', '401387']
    nosy_count = 9.0
    nosy_names = ['terry.reedy', 'Carl.Friedrich.Bolz', 'benjamin.peterson', 'lukasz.langa', 'fijall', 'martin.panter', 'serhiy.storchaka', 'Ronan.Lamy', 'miss-islington']
    pr_nums = ['28005', '28002', '28016', '28017', '28021', '28022', '28023', '28027', '28028']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue25130'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka serhiy-storchaka self-assigned this Sep 15, 2015
    @serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Sep 15, 2015
    @vadmium
    Copy link
    Member

    vadmium commented Sep 15, 2015

    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.

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @fijall
    Copy link
    Mannequin

    fijall mannequin commented Sep 16, 2015

    Hi

    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.

    @vadmium
    Copy link
    Member

    vadmium commented Sep 16, 2015

    Maciej: I put a few questions and comments in the code review. See the <https://bugs.python.org/review/25130/#ps15551\> (also linked next to Serhiy’s first patch).

    @fijall
    Copy link
    Mannequin

    fijall mannequin commented Sep 16, 2015

    Hi

    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

    @terryjreedy
    Copy link
    Member

    With 2.7 EOL, is this still relevant?

    @serhiy-storchaka
    Copy link
    Member Author

    Unfortunately Martin's comments are not available now, after shutting down the Rietveld service.

    Here is a new PR which contains extraction of PyPy changes related to calling gc.collect() for 3.8. I removed changes which look specific for PyPy and left changes which look common for every implementation without reference counting.

    @serhiy-storchaka serhiy-storchaka added 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Aug 27, 2021
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset eb263f9 by Carl Friedrich Bolz-Tereick in branch 'main':
    bpo-25130: Make unit-test about restricting the maximum number of nested blocks cpython-only (GH-28002)
    eb263f9

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 779b9ae by Miss Islington (bot) in branch '3.10':
    bpo-25130: Make unit-test about restricting the maximum number of nested blocks cpython-only (GH-28002) (GH-28016)
    779b9ae

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 1046cd0 by Serhiy Storchaka in branch '3.9':
    [3.9] bpo-25130: Make unit-test about restricting the maximum number of nested blocks cpython-only (GH-28002) (GH-28017)
    1046cd0

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 07d3d54 by Serhiy Storchaka in branch 'main':
    bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021)
    07d3d54

    @miss-islington
    Copy link
    Contributor

    New changeset a49398b by Miss Islington (bot) in branch '3.10':
    bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021)
    a49398b

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset dab74d6 by Serhiy Storchaka in branch '3.9':
    [3.9] bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021) (GH-28023)
    dab74d6

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 2a8127c by Serhiy Storchaka in branch 'main':
    bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005)
    2a8127c

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 330aabb by Serhiy Storchaka in branch '3.9':
    [3.9] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005). (GH-28028)
    330aabb

    @ambv
    Copy link
    Contributor

    ambv commented Sep 8, 2021

    New changeset 462c1f0 by Serhiy Storchaka in branch '3.10':
    [3.10] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005) (GH-28027)
    462c1f0

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants