Skip to content

Bring test.support docs up to date #55224

Closed

Description

@ncoghlan
BPO 11015
Nosy @birkenfeld, @terryjreedy, @ncoghlan, @giampaolo, @ezio-melotti, @sandrotosi, @serhiy-storchaka, @csabella
PRs
  • bpo-11015: Update test.support documentation #5610
  • [3.7] bpo-11015: Update test.support documentation (GH-5610) #5619
  • Files
  • issue11015.py3k.testdoc.1.patch
  • issue11015.py3k.remove_fcmp.1.patch
  • issue11015.py3k.remove_fcmp.2.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 = 'https://github.com/ncoghlan'
    closed_at = <Date 2018-02-11.19:43:25.613>
    created_at = <Date 2011-01-26.02:46:08.835>
    labels = ['easy', 'type-bug', '3.8', '3.7', 'tests', 'docs']
    title = 'Bring test.support docs up to date'
    updated_at = <Date 2018-02-11.19:43:25.610>
    user = 'https://github.com/ncoghlan'

    bugs.python.org fields:

    activity = <Date 2018-02-11.19:43:25.610>
    actor = 'terry.reedy'
    assignee = 'ncoghlan'
    closed = True
    closed_date = <Date 2018-02-11.19:43:25.613>
    closer = 'terry.reedy'
    components = ['Documentation', 'Tests']
    creation = <Date 2011-01-26.02:46:08.835>
    creator = 'ncoghlan'
    dependencies = []
    files = ['20567', '20884', '20885']
    hgrepos = []
    issue_num = 11015
    keywords = ['patch', 'easy']
    message_count = 30.0
    messages = ['127086', '127242', '127244', '127247', '127260', '127297', '129334', '129335', '129339', '129340', '129341', '129343', '129346', '135160', '135165', '135171', '135178', '135262', '135263', '136423', '136435', '136588', '173720', '311954', '311994', '311995', '311999', '312000', '312002', '312011']
    nosy_count = 11.0
    nosy_names = ['georg.brandl', 'terry.reedy', 'ncoghlan', 'giampaolo.rodola', 'ezio.melotti', 'eli.bendersky', 'sandro.tosi', 'docs@python', 'python-dev', 'serhiy.storchaka', 'cheryl.sabella']
    pr_nums = ['5610', '5619']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue11015'
    versions = ['Python 3.7', 'Python 3.8']

    Activity

    1. ncoghlan commented on Jan 26, 2011

      @ncoghlan
      ContributorAuthor

      The test.support docs are there to help CPython devs with writing good unit tests more easily. There are a few additions we've made in recent years that haven't made it into the .rst file, so it is easy to miss useful tools if you don't go looking through the module source code.

      There are some other helper modules (such as test.script_helper) that could also stand to be made easier to find.

      Fixing this is just a matter of doing a pass through test.support and the test directory looking for things that might be worth mentioning in the test package docs.

    2. added
      type-bug
      on Jan 26, 2011
    3. elibendersky commented on Jan 28, 2011

      elibenderskymannequin
      Mannequin

      I don't know if it matters much, but there's a slight mismatch in the description of test.support.verbose. The documentation says it's a boolean, while it's 0 or 1 in reality.

      Can it just be changed to True/False in the code of test.support and test.regrtest? It appears that all the other flags are True/False and there's no reason to keep this 0/1 (which is probably a relic from a distant past)

    4. elibendersky commented on Jan 28, 2011

      elibenderskymannequin
      Mannequin

      Here's a patch fixing the 0/1 to True/False in a couple of places in test.support and test.regrtest

      I ran the test suite and it passes.

      A review is needed to commit. I'll keep working on the documentation itself in the meantime.

    5. elibendersky commented on Jan 28, 2011

      elibenderskymannequin
      Mannequin

      Here's a patch to Doc/library/test.rst with additional several exported functions documented. These are the ones I found most important and clear. fcmp() is currently not documented (pending discussion in pydev).

    6. ncoghlan commented on Jan 28, 2011

      @ncoghlan
      ContributorAuthor

      verbose isn't a boolean at all - it's an integer. You can supply it multiple times to bump the logging level up even higher than normal.

      ~/devel/py3k/Lib/test$ grep "verbose >" *.py
      regrtest.py: if self.verbose > 1:
      test_cmd_line_script.py: if verbose > 1:
      test_cmd_line_script.py: if verbose > 1:
      test_cmd_line_script.py: if verbose > 1:
      test_cmd_line_script.py: if verbose > 1:
      test_cmd_line_script.py: if verbose > 1:
      test_fork1.py: if verbose > 1:
      test_fork1.py: if verbose > 1:

      (I didn't check explicitly, but I believe those verbose values are shorthand references to test.support.verbose)

    7. elibendersky commented on Jan 28, 2011

      elibenderskymannequin
      Mannequin

      Nick, agreed regarding verbose. Somehow I didn't think it would be used in other modules like that, and only looked in regrtest where I didn't see anything meaningful about verbose not being binary.

      It's a good thing to document it, then :)

    8. elibendersky commented on Feb 25, 2011

      elibenderskymannequin
      Mannequin

      Following the python-dev discussion, attaching a patch for removing fcmp and replacing its uses with assertAlmostEqual when needed.

      All tests pass and patchcheck is clean.

      Please review before I commit.

    9. birkenfeld commented on Feb 25, 2011

      @birkenfeld
      Member

      The divmod() part of the patch is wrong: assertAlmostEqual does not support tuple arguments.

      The test succeeds because it first does an exact equality check, which apparently is true on your platform. But if it wasn't, you'd get TypeErrors.

      Also, fcmp() has a different definition of what "almost equal" means, but I assume this has been regarded in the discussion.

    10. elibendersky commented on Feb 25, 2011

      elibenderskymannequin
      Mannequin

      Georg,

      Good catch on the tuples in assertAlmostEqual, thanks! I see three methods of resolution:

      1. Since the floats in this case are powers of 1/2, they could be tested for exact equality, or do you figure there are platforms where this is not guaranteed?
      2. I can make a local change in the test to assertAlmostEqual on each member of the tuple
      3. assertAlmostEqual on tuples can be added to the unittest module

      Any ideas?

      I can also commit (2) for the time being since it's the least dubious, and leave the resolution on 1 & 3 for later (and/or in separate issues).

      Regarding fcmp being not exactly assertAlmostEqual - it was discussed.

    11. birkenfeld commented on Feb 25, 2011

      @birkenfeld
      Member

      (2) would be my choice. (1) *should* be true, but this is a change in the test semantics. (3) would be feature creep and I don't think it's a good idea.

    12. elibendersky commented on Feb 25, 2011

      elibenderskymannequin
      Mannequin

      Attaching a revised patch with (2) implemented.

    13. birkenfeld commented on Feb 25, 2011

      @birkenfeld
      Member

      Yes, that looks good now.

    14. 11 remaining items

    15. csabella commented on Feb 10, 2018

      @csabella
      Contributor

      I have created a pull request adding documentation for all of test.support, including script_helper.py. I hope this will be helpful.

    16. ncoghlan commented on Feb 11, 2018

      @ncoghlan
      ContributorAuthor

      New changeset 988fb28 by Nick Coghlan (Cheryl Sabella) in branch 'master':
      bpo-11015: Update test.support documentation (GH-5610)
      988fb28

    17. ncoghlan commented on Feb 11, 2018

      @ncoghlan
      ContributorAuthor

      I merged Cheryl's PR to the dev branch, and triggered the backport to 3.7. If nobody beats me to it, I'll merge the latter tomorrow :)

    18. serhiy-storchaka commented on Feb 11, 2018

      @serhiy-storchaka
      Member

      I have left comments to PR.

    19. ncoghlan commented on Feb 11, 2018

      @ncoghlan
      ContributorAuthor

      New changeset a0b998d by Nick Coghlan (Miss Islington (bot)) in branch '3.7':
      bpo-11015: Update test.support documentation (GH-5619)
      a0b998d

    20. csabella commented on Feb 11, 2018

      @csabella
      Contributor

      Thanks Nick for merging. Should I open a new PR to address Serhiy's review or fix them on the original PR?

    21. terryjreedy commented on Feb 11, 2018

      @terryjreedy
      Member

      Since Nick already merged and backported, at least a new PR is needed. Since this is an old issue with a long discussion and several inactives on the nosy list, I suggest a new issue starting from the merge result as a base: "More revisions to test.support docs". Make a list of Serhiy's questions and comments.

      TESTFN_NONASCII - How different from TESTFN_UNICODE?
      PGO - value? True/False?
      TEST_SUPPORT_DIR - Not used.
      ...

      Add Nick, Serhiy, and me as nosy. We can discuss there how to handle the additional issues.

    22. added
      docs
      tests
      3.7 (EOL)
      on Feb 11, 2018
    23. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.7 (EOL)3.8 (EOL)docseasyteststype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions