GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Deprecate obsolete functions in unittest · Issue #50096 · python/cpython

Deprecate obsolete functions in unittest #50096

New issue
Copy link
New issue
Copy link
Closed
Closed
Deprecate obsolete functions in unittest#50096
Copy link
Assignees
voidspace
Labels
3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@voidspace
voidspace
opened on Apr 25, 2009
Issue body actions
BPO 5846
Nosy @birkenfeld, @ezio-melotti, @voidspace, @ambv, @serhiy-storchaka, @erlend-aasland
PRs
  • bpo-5846: Deprecate obsolete methods makeSuite, findTestCases, and getTestCaseNames in unittest #20400
  • bpo-5846: Deprecate obsolete methods in unittest #28299
  • bpo-5846: Do not use obsolete unittest functions. #28303
  • bpo-5846: Fix deprecations for obsolete unittest functions and add tests. #28382
  • 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/voidspace'
    closed_at = <Date 2021-09-17.09:11:48.612>
    created_at = <Date 2009-04-25.23:44:59.267>
    labels = ['type-feature', 'library', '3.11']
    title = 'Deprecate obsolete functions in unittest'
    updated_at = <Date 2021-09-18.12:12:58.564>
    user = 'https://github.com/voidspace'

    bugs.python.org fields:

    activity = <Date 2021-09-18.12:12:58.564>
    actor = 'erlendaasland'
    assignee = 'michael.foord'
    closed = True
    closed_date = <Date 2021-09-17.09:11:48.612>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2009-04-25.23:44:59.267>
    creator = 'michael.foord'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 5846
    keywords = ['patch']
    message_count = 13.0
    messages = ['86574', '86687', '87298', '87361', '87592', '386705', '401691', '401878', '401899', '402014', '402016', '402042', '402126']
    nosy_count = 6.0
    nosy_names = ['georg.brandl', 'ezio.melotti', 'michael.foord', 'lukasz.langa', 'serhiy.storchaka', 'erlendaasland']
    pr_nums = ['20400', '28299', '28303', '28382']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue5846'
    versions = ['Python 3.11']

    Activity

    1. voidspace commented on Apr 25, 2009

      @voidspace
      voidspace
      on Apr 25, 2009
      ContributorAuthor
      More actions

      _makeLoader, getTestCaseNames, makeSuite and findTestCases have all had
      the comment "these functions should be considered obsolete" for a long time.

      Is is ok to go straight to deprecation or should they be marked with
      PendingDeprecationWarning first?

    2. voidspace
      self-assigned this
      on Apr 25, 2009
    3. voidspace
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      on Apr 25, 2009
    4. birkenfeld commented on Apr 27, 2009

      @birkenfeld
      birkenfeld
      on Apr 27, 2009
      Member
      More actions

      I guess adding a standard DeprecationWarning is fine in these cases.

    5. voidspace commented on May 5, 2009

      @voidspace
      voidspace
      on May 5, 2009
      ContributorAuthor
      More actions

      So it turns out that unittest.makeSuite is used about 100 times
      throughout the standard library tests.

      More than half the time it can be replaced with
      unittest.TestLoader().loadTestsFromTestCase(...)

      Some of the other times a loader needs to be constructed and then a
      testMethodPrefix of 'Check' set (yuck!).

      I'm about halfway through a patch that does this. Think it is worth
      continuing or shall I drop it. I don't mind doing it so long as
      *someone* thinks it is worthwhile... :-)

      (I haven't yet checked for getTestCaseNames but I imagine there will be
      a bunch of these to fix as well.)

      Another possibility is to move the functions into test_support
      (deprecating first) where at least they are out of unittest.

    6. birkenfeld commented on May 7, 2009

      @birkenfeld
      birkenfeld
      on May 7, 2009
      Member
      More actions

      I'm sure Gerhard wouldn't say no to changing the sqlite3 test prefix to
      "test_"...

    7. voidspace commented on May 11, 2009

      @voidspace
      voidspace
      on May 11, 2009
      ContributorAuthor
      More actions

      Hehe - I wasn't actually doing that, just replacing the use of the
      obsolete functions.

    8. ezio-melotti
      added
      type-featureA feature request or enhancementA feature request or enhancement
      on Sep 26, 2012
    9. erlend-aasland commented on Feb 9, 2021

      @erlend-aasland
      erlend-aasland
      on Feb 9, 2021
      Contributor
      More actions

      I'm sure Gerhard wouldn't say no to changing the sqlite3 test prefix to
      "test_"...

      FYI, the sqlite3 tests have now been cleaned up (GH-20538).

      Remaining occurrences in Lib/test:
      Lib/test/test_pdb.py: unittest.makeSuite(PdbTestCase),
      Lib/test/test_dbm.py: suites = [unittest.makeSuite(c) for c in classes]
      Lib/test/test_io.py: suite = unittest.TestSuite([unittest.makeSuite(test) for test in tests])
      Lib/test/test_threading_local.py: suite.addTest(unittest.makeSuite(ThreadLocalTest))
      Lib/test/test_threading_local.py: suite.addTest(unittest.makeSuite(PyThreadingLocalTest))
      Lib/test/test_zipimport.py: # item in a list sorted by name, like unittest.makeSuite() does.)
      Lib/test/support/init.py: suite.addTest(unittest.findTestCases(sys.modules[cls]))
      Lib/test/support/init.py: suite.addTest(unittest.makeSuite(cls))
      Lib/test/support/testresult.py: suite.addTest(unittest.makeSuite(TestTests))
      Lib/test/test_email/torture_test.py: suite.addTest(unittest.makeSuite(testclass))
      Lib/test/test_math.py: suite.addTest(unittest.makeSuite(MathTests))
      Lib/test/test_math.py: suite.addTest(unittest.makeSuite(IsCloseTests))

    10. serhiy-storchaka commented on Sep 13, 2021

      @serhiy-storchaka
      serhiy-storchaka
      on Sep 13, 2021
      Member
      More actions

      New changeset 851811f by Serhiy Storchaka in branch 'main':
      bpo-5846: Do not use obsolete unittest functions. (GH-28303)
      851811f

    11. ambv commented on Sep 15, 2021

      @ambv
      ambv
      on Sep 15, 2021
      Contributor
      More actions

      New changeset ff6d2cc by Erlend Egeberg Aasland in branch 'main':
      bpo-5846: Deprecate obsolete methods in unittest (GH-28299)
      ff6d2cc

    12. serhiy-storchaka commented on Sep 15, 2021

      @serhiy-storchaka
      serhiy-storchaka
      on Sep 15, 2021
      Member
      More actions

      I do not think that PR 28299 is correct. We want to deprecate these functions which are implemented in the unittest.loader module, not just names exported to the unittest module.

    13. serhiy-storchaka commented on Sep 17, 2021

      @serhiy-storchaka
      serhiy-storchaka
      on Sep 17, 2021
      Member
      More actions

      New changeset b2b035a by Serhiy Storchaka in branch 'main':
      bpo-5846: Fix deprecations for obsolete unittest functions and add tests. (GH-28382)
      b2b035a

    14. serhiy-storchaka
      added
      3.11only security fixesonly security fixes
      on Sep 17, 2021
    15. serhiy-storchaka
      closed this as completedon Sep 17, 2021
    16. erlend-aasland commented on Sep 17, 2021

      @erlend-aasland
      erlend-aasland
      on Sep 17, 2021
      Contributor
      More actions

      _makeLoader is not deprecated yet, so we might keep this open a little bit more.

    17. serhiy-storchaka commented on Sep 17, 2021

      @serhiy-storchaka
      serhiy-storchaka
      on Sep 17, 2021
      Member
      More actions

      It is an internal function. We can remove it without deprecation.

    18. erlend-aasland commented on Sep 18, 2021

      @erlend-aasland
      erlend-aasland
      on Sep 18, 2021
      Contributor
      More actions

      It is an internal function. We can remove it without deprecation.

      How convenient :)

    19. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    20. hugovk commented on May 24, 2023

      @hugovk
      hugovk
      on May 24, 2023
      Member
      More actions

      Please see PR #104836 to remove them in 3.13.

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

    Metadata

    Metadata

    Assignees

    • @voidspace
      voidspace

    Labels

    3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.