Skip to content

Make tests more PyPy compatible #69317

Closed
Closed

Description

@serhiy-storchaka
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']

    Activity

    1. serhiy-storchaka commented on Sep 15, 2015

      @serhiy-storchaka
      MemberAuthor

      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.

    2. vadmium commented on Sep 15, 2015

      @vadmium
      Member

      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.

    3. serhiy-storchaka commented on Sep 16, 2015

      @serhiy-storchaka
      MemberAuthor

      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.

    4. serhiy-storchaka commented on Sep 16, 2015

      @serhiy-storchaka
      MemberAuthor

      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.

    5. fijall commented on Sep 16, 2015

      fijallmannequin
      Mannequin

      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.

    6. vadmium commented on Sep 16, 2015

      @vadmium
      Member

      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).

    7. fijall commented on Sep 16, 2015

      fijallmannequin
      Mannequin

      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

    8. terryjreedy commented on Mar 23, 2021

      @terryjreedy
      Member

      With 2.7 EOL, is this still relevant?

    9. serhiy-storchaka commented on Aug 27, 2021

      @serhiy-storchaka
      MemberAuthor

      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.

    10. serhiy-storchaka commented on Aug 28, 2021

      @serhiy-storchaka
      MemberAuthor

      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

    11. serhiy-storchaka commented on Aug 28, 2021

      @serhiy-storchaka
      MemberAuthor

      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

    12. serhiy-storchaka commented on Aug 28, 2021

      @serhiy-storchaka
      MemberAuthor

      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

    13. serhiy-storchaka commented on Aug 29, 2021

      @serhiy-storchaka
      MemberAuthor

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

    14. miss-islington commented on Aug 29, 2021

      @miss-islington
      Contributor

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

    15. serhiy-storchaka commented on Aug 29, 2021

      @serhiy-storchaka
      MemberAuthor

      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

    16. serhiy-storchaka commented on Aug 29, 2021

      @serhiy-storchaka
      MemberAuthor

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

    17. serhiy-storchaka commented on Aug 29, 2021

      @serhiy-storchaka
      MemberAuthor

      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

    18. ambv commented on Sep 8, 2021

      @ambv
      Contributor

      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

    19. transferred this issue fromon Apr 10, 2022
    20. methane commented on Sep 15, 2026

      @methane
      Member

      Let's close this and continue in #115142

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    3.10 (EOL)end of life3.11only security fixes3.9 (EOL)end of lifetestsTests in the Lib/test dirtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions