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

test_osx_env failing #49658

Closed
benjaminp opened this issue Mar 2, 2009 · 9 comments
Closed

test_osx_env failing #49658

benjaminp opened this issue Mar 2, 2009 · 9 comments
Assignees
Labels
tests Tests in the Lib/test dir

Comments

@benjaminp
Copy link
Contributor

BPO 5408
Nosy @ronaldoussoren, @benjaminp, @ned-deily
Files
  • patch-nad0021-py3k-30.txt
  • 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/ronaldoussoren'
    closed_at = <Date 2009-03-04.23:28:45.384>
    created_at = <Date 2009-03-02.23:17:05.696>
    labels = ['tests']
    title = 'test_osx_env failing'
    updated_at = <Date 2009-03-04.23:28:45.383>
    user = 'https://github.com/benjaminp'

    bugs.python.org fields:

    activity = <Date 2009-03-04.23:28:45.383>
    actor = 'benjamin.peterson'
    assignee = 'ronaldoussoren'
    closed = True
    closed_date = <Date 2009-03-04.23:28:45.384>
    closer = 'benjamin.peterson'
    components = ['Tests']
    creation = <Date 2009-03-02.23:17:05.696>
    creator = 'benjamin.peterson'
    dependencies = []
    files = ['13232']
    hgrepos = []
    issue_num = 5408
    keywords = []
    message_count = 9.0
    messages = ['83046', '83057', '83059', '83067', '83147', '83158', '83160', '83162', '83163']
    nosy_count = 3.0
    nosy_names = ['ronaldoussoren', 'benjamin.peterson', 'ned.deily']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue5408'
    versions = ['Python 3.1']

    @benjaminp
    Copy link
    Contributor Author

    Mac OS 10.4 PPC debug build

    test_osx_env
    [31492 refs]
    Could not find platform independent libraries <prefix>
    Could not find platform dependent libraries <exec_prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    Fatal Python error: Py_Initialize: can't initialize sys standard streams
    ImportError: No module named encodings.utf_8
    test test_osx_env failed -- Traceback (most recent call last):
      File "/temp/python/py3k/Lib/test/test_osx_env.py", line 27, in
    test_pythonexecutable_sets_sys_executable
        self._check_sys('PYTHONEXECUTABLE', '==', 'sys.executable')
      File "/temp/python/py3k/Lib/test/test_osx_env.py", line 24, in _check_sys
        self.assertEqual(rc, 2, "expected %s %s %s" % (ev, cond, sv))
    AssertionError: expected PYTHONEXECUTABLE == sys.executable

    @benjaminp benjaminp added the tests Tests in the Lib/test dir label Mar 2, 2009
    @ronaldoussoren
    Copy link
    Contributor

    Is this a standard unix build or a framework build?

    @ned-deily
    Copy link
    Member

    It appears the test doesn't work correctly for non-framework builds,
    something I didn't test. A patch is forthcoming.

    @ned-deily
    Copy link
    Member

    ANALYSIS In a non-framework build, when PYTHONEXECUTABLE is set to a
    invalid value, getpath.c is unable to determine appropriate
    values for sys.prefix and sys.path so the interpreter fails
    in initialization.

    SOLUTION Simplify the test and supply appropriate values so the test
    works for both framework and non-framework builds.

    APPLIES py3k, 3.0

    @ronaldoussoren
    Copy link
    Contributor

    Ned: IMHO your patch is not correct. test_osx_env tests behaviour that's
    only valid for a framework build, and should therefore only run when
    testing a framework build.

    The easiest way to accomplish that is to change the test in
    test_osx_env.main to:

       if sys.platform == 'darwin' and 
    sysconfig.get_config_var('WITH_NEXT_FRAMEWORK'):

    (with an "from distutils import sysconfig" statement just above the
    test).

    I will commit this fix when I've actually tested it.

    @ronaldoussoren
    Copy link
    Contributor

    Committed my fix as r70179 (3.x) and r70180 (30-maint).

    Benjamin: can you confirm this actually fixes the issue with a non-
    framework build, I don't know if I'll be able to test that before the
    first 3.1a release.

    @ned-deily
    Copy link
    Member

    I don't have strong feelings about it one way or the other. As far as I
    can tell from the code and testing and the documented behavior, the effect
    on sys.executable is independent of whether it is a framework build or
    not. But I'm fine with narrowing the scope of the test.

    @ronaldoussoren
    Copy link
    Contributor

    The effect on sys.executable is always present, the test is only valid for
    a framework build because that's the only build that can find sys.prefix
    without looking at sys.executable. Setting PYTHONEXECUTABLE with a non-
    framework build is only valid if the value of the variable point's to a
    python executable in the right location within the installation tree.

    @benjaminp
    Copy link
    Contributor Author

    Thumbs up here! Thanks.

    @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
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants