Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify MODULE variable in test_enum.py #90576

Closed
sobolevn opened this issue Jan 17, 2022 · 2 comments
Closed

Simplify MODULE variable in test_enum.py #90576

sobolevn opened this issue Jan 17, 2022 · 2 comments
Labels
3.11 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

BPO 46418
Nosy @ethanfurman, @sobolevn
PRs
  • bpo-46418: simplify MODULE declaration in test_enum #30647
  • 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-17.21:19:10.061>
    created_at = <Date 2022-01-17.18:50:15.980>
    labels = ['type-bug', 'tests', '3.11']
    title = 'Simplify `MODULE` variable in `test_enum.py`'
    updated_at = <Date 2022-01-17.21:19:10.060>
    user = 'https://github.com/sobolevn'

    bugs.python.org fields:

    activity = <Date 2022-01-17.21:19:10.060>
    actor = 'sobolevn'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-17.21:19:10.061>
    closer = 'sobolevn'
    components = ['Tests']
    creation = <Date 2022-01-17.18:50:15.980>
    creator = 'sobolevn'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46418
    keywords = ['patch']
    message_count = 2.0
    messages = ['410818', '410821']
    nosy_count = 2.0
    nosy_names = ['ethan.furman', 'sobolevn']
    pr_nums = ['30647']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46418'
    versions = ['Python 3.11']

    @sobolevn
    Copy link
    Member Author

    Right now MODULE in Lib/test/test_enum.py is defined as:

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

    I dived into history and did not find any reasoning why it should not be just __name__. (But, I might had missed it: the first usage of it is dated back to 2016)

    This came up in #30641

    So, I think it is a good idea to simplify it like this:

    MODULE = __name__

    Probably, this won't cause any more confusion in the future :)

    I am not going to change all MODULE usages to __name__ to keep the diff as minimal as possible.

    @sobolevn sobolevn added 3.11 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jan 17, 2022
    @ethanfurman
    Copy link
    Member

    New changeset 596cf51 by Nikita Sobolev in branch 'main':
    bpo-46418: [Enum] simplify MODULE declaration in tests (GH-30647)
    596cf51

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants