Skip to content

Direct invocation of Lib/test/test_typing.py fails #90574

Closed

Description

@sobolevn
BPO 46416
Nosy @tiran, @sobolevn, @Fidget-Spinner
PRs
  • bpo-46416: fix direct invocation of Lib/test/test_typing.py #30641
  • [3.10] bpo-46416: Allow direct invocation of Lib/test/test_typing.py (GH-30641) #30697
  • [3.9] bpo-46416: Allow direct invocation of Lib/test/test_typing.py (GH-30641) #30698
  • [3.9] bpo-46416: Allow direct invocation of Lib/test/test_typing.py (GH-30641) #30707
  • 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 = <Date 2022-01-27.14:44:04.785>
    created_at = <Date 2022-01-17.15:22:26.913>
    labels = ['type-bug', 'tests', '3.11']
    title = 'Direct invocation of `Lib/test/test_typing.py` fails'
    updated_at = <Date 2022-01-27.14:44:04.785>
    user = 'https://github.com/sobolevn'

    bugs.python.org fields:

    activity = <Date 2022-01-27.14:44:04.785>
    actor = 'sobolevn'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-27.14:44:04.785>
    closer = 'sobolevn'
    components = ['Tests']
    creation = <Date 2022-01-17.15:22:26.913>
    creator = 'sobolevn'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46416
    keywords = ['patch']
    message_count = 5.0
    messages = ['410800', '410950', '411488', '411491', '411522']
    nosy_count = 3.0
    nosy_names = ['christian.heimes', 'sobolevn', 'kj']
    pr_nums = ['30641', '30697', '30698', '30707']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46416'
    versions = ['Python 3.11']

    Activity

    1. sobolevn commented on Jan 17, 2022

      @sobolevn
      MemberAuthor

      Here's the problem:

      » ./python.exe Lib/test/test_typing.py
      ........................................................................................................................................................................................................s.....................................................................................................................F.........................................................................................
      ======================================================================
      FAIL: test_special_attrs2 (__main__.SpecialAttrsTests)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/Users/sobolev/Desktop/cpython/Lib/test/test_typing.py", line 5068, in test_special_attrs2
          self.assertEqual(
          ^^^^^^^^^^^^^^^^^
      AssertionError: '__main__' != 'test.test_typing'
      - __main__
      + test.test_typing
      

      I think it is a good idea to use the same hack we have in test_enum.py:

      MODULE = ('test.test_enum', '__main__')[__name__=='__main__']

      MODULE = ('test.test_typing', '__main__')[__name__=='__main__']

      PR is on its way :)

    2. added
      3.11only security fixes
      testsTests in the Lib/test dir
      type-bugAn unexpected behavior, bug, or error
      on Jan 17, 2022
    3. Fidget-Spinner commented on Jan 19, 2022

      @Fidget-Spinner
      Member

      New changeset 2792d6d by Nikita Sobolev in branch 'main':
      bpo-46416: Allow direct invocation of [Lib/test/test_typing.py](https://github.com/python/cpython/blob/main/Lib/test/test_typing.py) (GH-30641)
      2792d6d

    4. Fidget-Spinner commented on Jan 24, 2022

      @Fidget-Spinner
      Member

      New changeset eaeb994 by Nikita Sobolev in branch '3.10':
      [3.10] bpo-46416: Allow direct invocation of [Lib/test/test_typing.py](https://github.com/python/cpython/blob/main/Lib/test/test_typing.py) (GH-30641) (GH-30697)
      eaeb994

    5. tiran commented on Jan 24, 2022

      @tiran
      Member

      I noticed that you have been looking into the __main__ block of test modules. Wouldn't it make more sense to just remove the __main__ and have all tests go through regrtest? Everybody should use

      ./python -m regrtest test_typing

      or the Windows equivalent to run typing tests.

    6. sobolevn commented on Jan 24, 2022

      @sobolevn
      MemberAuthor

      During this work some people have mentioned that they actually use
      '__main__' for local debugging of tests.
      I don't think that I am familiar enough with the existing workflow to make
      any educated decision :)

      пн, 24 янв. 2022 г. в 19:34, Christian Heimes <report@bugs.python.org>:

      Christian Heimes <lists@cheimes.de> added the comment:

      I noticed that you have been looking into the __main__ block of test
      modules. Wouldn't it make more sense to just remove the __main__ and have
      all tests go through regrtest? Everybody should use

      ./python -m regrtest test_typing

      or the Windows equivalent to run typing tests.

      ----------
      nosy: +christian.heimes


      Python tracker <report@bugs.python.org>
      <https://bugs.python.org/issue46416\>


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

    No one assigned

      Labels

      3.11only security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions