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

unset PYTHON* environment variables when running tests #56610

Closed
henryprecheur mannequin opened this issue Jun 24, 2011 · 4 comments
Closed

unset PYTHON* environment variables when running tests #56610

henryprecheur mannequin opened this issue Jun 24, 2011 · 4 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@henryprecheur
Copy link
Mannequin

henryprecheur mannequin commented Jun 24, 2011

BPO 12401
Nosy @vstinner, @ezio-melotti, @voidspace
Files
  • empty_environment.diff
  • 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 2014-06-28.00:11:25.843>
    created_at = <Date 2011-06-24.21:57:56.343>
    labels = ['invalid', 'type-bug', 'tests']
    title = 'unset PYTHON* environment variables when running tests'
    updated_at = <Date 2014-06-28.00:11:25.842>
    user = 'https://bugs.python.org/henryprecheur'

    bugs.python.org fields:

    activity = <Date 2014-06-28.00:11:25.842>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-06-28.00:11:25.843>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2011-06-24.21:57:56.343>
    creator = 'henry.precheur'
    dependencies = []
    files = ['22493']
    hgrepos = []
    issue_num = 12401
    keywords = ['patch']
    message_count = 4.0
    messages = ['138993', '139263', '221753', '221757']
    nosy_count = 6.0
    nosy_names = ['vstinner', 'ezio.melotti', 'henry.precheur', 'Arfrever', 'michael.foord', 'BreamoreBoy']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue12401'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @henryprecheur
    Copy link
    Mannequin Author

    henryprecheur mannequin commented Jun 24, 2011

    "make test" calls Python with the -E option which ignore the PYTHON*
    environment variables, but Python sub-processes aren't necessarily called with the -E options. For example test_displayhook_unencodable in test_cmd_line. This created problems with my own PYTHONSTARTUP script.

    I see 2 solutions to this problems:

    1. Fix the tests that might be affected by such problems, by adding the -E option everywhere needed.
    2. Fix the Makefile and unset all the PYTHON* environment variables in it.

    I think that solution #2 is better. Fixing the tests can be done today, but the authors of future tests might not be aware of this issue. By fixing the Makefile we prevent this problem to occur again in the future.

    @henryprecheur henryprecheur mannequin added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jun 24, 2011
    @henryprecheur
    Copy link
    Mannequin Author

    henryprecheur mannequin commented Jun 27, 2011

    Here's a small patch to call regression tests without any environment variable defined. It's probably a good thing to run all the tests with a clean state, this way they are less likely to fail for mysterious external reasons. For example test_displayhook_unencodable was failing because I was overriding displayhook in my PYTHONSTARTUP file.

    On the other hand, some problems with environment variables might go unnoticed. But I don't think there's much risk.

    Note that test_distutils will fail with this patch if bpo-12420 is not taken care of beforehand.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 27, 2014

    Can we have a formal patch review please as "make test" means nothing to me.

    @vstinner
    Copy link
    Member

    1. Fix the tests that might be affected by such problems, by adding the -E option everywhere needed.

    Yes, this is the right fix. I'm closing this issue because it didn't get any activity since 3 years.

    If you are interested to add -E in tests, please open a new issue with a patch.

    empty_environment.diff is wrong, we should ignore PYTHON environement variables to have reliable tests.

    @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
    tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant