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 — unittest: display time used by each test case · Issue #48330 · python/cpython

unittest: display time used by each test case #48330

New issue
Copy link
New issue
Copy link
Closed
Closed
unittest: display time used by each test case#48330
Copy link
Labels
3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement

Description

pprokop
mannequin
opened on Oct 8, 2008
Issue body actions
BPO 4080
Nosy @rhettinger, @giampaolo, @ezio-melotti, @merwok, @voidspace
PRs
  • bpo-4080: unittest durations #12271
  • Files
  • pyunit_time.patch: display time of each unit test - patch
  • unittest_runTime.patch: test case run time measure patch
  • 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 = None
    closed_at = None
    created_at = <Date 2008-10-08.20:28:15.274>
    labels = ['tests', 'type-feature', 'library', '3.9']
    title = 'unittest: display time used by each test case'
    updated_at = <Date 2020-02-16.12:49:33.700>
    user = 'https://bugs.python.org/pprokop'

    bugs.python.org fields:

    activity = <Date 2020-02-16.12:49:33.700>
    actor = 'giampaolo.rodola'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'Tests']
    creation = <Date 2008-10-08.20:28:15.274>
    creator = 'pprokop'
    dependencies = []
    files = ['11751', '15332']
    hgrepos = []
    issue_num = 4080
    keywords = ['patch']
    message_count = 17.0
    messages = ['74545', '87989', '95253', '109448', '110692', '110800', '110883', '154650', '154678', '154687', '154769', '154771', '154776', '155721', '176157', '337648', '362067']
    nosy_count = 8.0
    nosy_names = ['rhettinger', 'techtonik', 'giampaolo.rodola', 'ezio.melotti', 'eric.araujo', 'pprokop', 'michael.foord', 'piotr.dobrogost']
    pr_nums = ['12271']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue4080'
    versions = ['Python 3.9']

    Linked PRs

    • gh-48330: assert warning is emitted on unittest.TestResult with no addDuration #103309
    • gh-48330: address review comments to PR-12271 #103209
    Reacted by Pat Myron

    Activity

    Next
    1. pprokop commented on Oct 8, 2008

      @pprokop
      pprokopmannequin
      on Oct 8, 2008
      MannequinAuthor
      More actions

      I've needed to measure each unit test running time
      to measure the performance changing of each functionality
      that every test case tests.
      Latest version of pyunit has only displayed summary running time of the
      suite, so I've implemented small enhancement to unittest.py that
      (in verbose mode) shows time of each test case run.
      Maybe that would be usefull for anybody else?

    2. pprokop
      added
      type-featureA feature request or enhancementA feature request or enhancement
      on Oct 8, 2008
    3. devdanzin
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      testsTests in the Lib/test dirTests in the Lib/test dir
      on May 17, 2009
    4. voidspace commented on May 17, 2009

      @voidspace
      voidspace
      on May 17, 2009
      Contributor
      More actions

      Needs test and documentation. Otherwise looks good.

    5. pprokop commented on Nov 14, 2009

      @pprokop
      pprokopmannequin
      on Nov 14, 2009
      MannequinAuthor
      More actions

      Repack of unittest was good idea. It is a patch against trunk, one test
      case is provided and documentation update.

    6. ezio-melotti commented on Jul 7, 2010

      @ezio-melotti
      ezio-melotti
      on Jul 7, 2010
      Member
      More actions

      The idea is interesting, but I would prefer to have a way to enable/disable this feature (and maybe even specify its format, e.g. the number of decimals). Moving the logic to an external function (possibly used as a decorator) might avoid some code duplication, but OTOH it would probably slow down the execution and the timing a little (I'm not sure that matters though).

    7. BreamoreBoy commented on Jul 18, 2010

      @BreamoreBoy
      BreamoreBoymannequin
      on Jul 18, 2010
      Mannequin
      More actions

      Pawel, could you please provide an update wrt Ezio's comment on msg109448, thanks.

    8. pprokop commented on Jul 19, 2010

      @pprokop
      pprokopmannequin
      on Jul 19, 2010
      MannequinAuthor
      More actions

      I think that a delay time of calling a decorator is not important, because this should be constant in each test execution, so no matter.
      I shall be able to provide a patch in few days.
      Thanks

    9. voidspace commented on Jul 20, 2010

      @voidspace
      voidspace
      on Jul 20, 2010
      Contributor
      More actions

      I am in the process of creating an extension mechanism for unittest which will make adding this sort of use case to unittest much easier. *Even* if it is added to the core it should be in the form of an extension (plugin) so please don't update the patch until this is in place.

    10. piotrdobrogost commented on Feb 29, 2012

      @piotrdobrogost
      piotrdobrogostmannequin
      on Feb 29, 2012
      Mannequin
      More actions

      @michael Foord

      I am in the process of creating an extension mechanism for unittest
      which will make adding this sort of use case to unittest much easier

      How is it going?

    11. merwok
      changed the title [-]pyunit - display time of each test case - patch[/-] [+]unittest: display time of each test case[/+] on Mar 1, 2012
    12. rhettinger commented on Mar 1, 2012

      @rhettinger
      rhettinger
      on Mar 1, 2012
      Contributor
      More actions

      I think this would be a useful feature.

    13. voidspace commented on Mar 1, 2012

      @voidspace
      voidspace
      on Mar 1, 2012
      Contributor
      More actions

      Yes, it would definitely be useful (as would a count of how far through the test run we are [27/129] style). Getting to completing (even for testing) the "extensible" unittest is something I will still do (and nose2 is being built off the prototype work I did), but isn't going to happen immediately - so it's not a good reason to hold up these improvements.

      I'll be sprinting at PyCon and look at this issue then.

      I'm keen to avoid proliferating command line parameters to the unittest test runner. Ezio - why would you want to disable this feature?

    14. ezio-melotti commented on Mar 2, 2012

      @ezio-melotti
      ezio-melotti
      on Mar 2, 2012
      Member
      More actions

      Because it looks like line noise and doesn't provide an useful information in most of the cases (at least for me), see e.g.:

      + test_format (main.MyTestCase) ... [0.000612s] skipped 'not supported in this library version'
      + test_nothing (main.MyTestCase) ... [0.000486s] skipped 'demonstrating skipping'
      + test_windows_support (main.MyTestCase) ... [0.000090s] skipped 'requires Windows'

      It might still be useful to find the slowest test(s), or for test suites that take a long time (so I'm not opposed to having it as an option that can be enabled if needed), but for most of the tests it will just show an almost meaningless fraction of second.

    15. 9 remaining items

    16. giampaolo commented on Feb 16, 2020

      @giampaolo
      giampaolo
      on Feb 16, 2020
      Contributor
      More actions

      I updated the PR for Python 3.9. I think it's ready to be merged. Can someone involved in unittest take a look at it?

    17. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    18. serhiy-storchaka
      added this to Unittest & doctest issueson May 20, 2022
    19. iritkatriel
      added
      3.12only security fixesonly security fixes
      and removed
      3.9 (EOL)end of lifeend of life
      on Nov 25, 2022
    20. iritkatriel
      added 2 commits that reference this issue on Apr 6, 2023

      pythongh-48330: assert warning is emitted on unittest.TestResult with…

      de69a81

      gh-48330: assert warning is emitted on unittest.TestResult with no ad…

      52bc2e7
    21. warsaw
      added a commit that references this issue on Apr 11, 2023

      pythongh-48330: assert warning is emitted on unittest.TestResult with…

      c238a92
    22. hrnciar
      added a commit that references this issue on Apr 12, 2023

      00398: pythongh-48330: assert warning is emitted on unittest.TestResu…

      bed7ec9
    23. giampaolo
      added a commit that references this issue on Apr 16, 2023

      gh-48330: address review comments to PR-12271 (#103209)

      ff3303e
    24. carljm
      added 2 commits that reference this issue on Apr 17, 2023

      Merge branch 'main' into superopt

      5136459

      Merge branch 'superopt' into superopt_spec

      079c65a
    25. hugovk commented on Nov 27, 2023

      @hugovk
      hugovk
      on Nov 27, 2023
      Member
      More actions

      Closing, the PR has been merged: #12271 👍

      Reacted by Pat Myron
    26. hugovk
      closed this as completedon Nov 27, 2023
    27. github-project-automation
      moved this to Done in Unittest & doctest issueson Nov 27, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement

      Projects

      • Unittest & doctest issues
        Status
        Done
        Show more project fields

      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.