This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_site and macframework builds fails
Type: behavior Stage: resolved
Components: macOS, Tests Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: eric.araujo, ixokai, louiscipher, ned.deily, python-dev, ronaldoussoren, vinay.sajip
Priority: normal Keywords: easy, needs review, patch

Created on 2011-01-10 19:54 by ixokai, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
smime.p7s ronaldoussoren, 2011-10-18 09:26
Messages (14)
msg125919 - (view) Author: Stephen Hansen (ixokai) (Python triager) Date: 2011-01-10 19:54
With the latest from branches/py3k, in a framework build, I get:

Wimp:build pythonbuildbot$ ./python.exe -m test.regrtest test_site
[1/1] test_site
test test_site failed -- Traceback (most recent call last):
  File "/Users/pythonbuildbot/32test/build/Lib/test/test_site.py", line 225, in test_getsitepackages
    self.assertEqual(len(dirs), 2)
AssertionError: 3 != 2

1 test failed:
    test_site
Wimp:build pythonbuildbot$ ./python.exe
Python 3.2b2+ (py3k:87899M, Jan 10 2011, 11:08:48) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.getsitepackages()
['/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages', '/Library/Frameworks/Python.framework/Versions/3.2/lib/site-python', '/Library/Python/3.2/site-packages']

Those three dirs look correct for me, but the test is written to find exactly two from site.getsitepackages() -- the code, however, adds an extra in the event of framework builds.
msg125920 - (view) Author: Stephen Hansen (ixokai) (Python triager) Date: 2011-01-10 19:55
... oops! Apparently dupe. Forgot to search first. Ignore.
msg140655 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-07-19 11:29
I'd like to reopen this, as it doesn't seem to be a duplicate of #8084. Specifically, test_getsitepackages in test_sitepackages appears to be wrong, since it has a correct test for platform builds later in the method, but the failure occurs earlier because the path "os.sep == '/'" is taken on OS X. The test should be restructured as e.g.

    if sys.platform in ('os2emx', 'riscos'):
        # stuff for OS/2, RISCOS
    elif (sys.platform == "darwin" and
            sysconfig.get_config_var("PYTHONFRAMEWORK")):
        # OS X platform builds
    elif os.sep == '/':
        # OS X non-platform builds, Linux, FreeBSD etc.
    else:
        # other platforms

That the test itself is broken is not the thrust of #8084.
msg140663 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-19 13:11
How can we detect framework builds from Python code?  Maybe there is a variable in sysconfig?
msg140664 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-19 13:12
Hem, I should have re-read Vinay’s message before posting :)  Marking as easy.
msg140667 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-07-19 14:10
This is now fixed in pythonv, see

https://bitbucket.org/vinay.sajip/pythonv/changeset/a59a3868d185/raw/pythonv-a59a3868d185.diff
msg145355 - (view) Author: Bryce Verdier (louiscipher) Date: 2011-10-11 18:15
I would like to help by reviewing the patch, however I'm unsure about how to do the framework aspect of this. Can someone send me instructions or a link on how I would set this up to test?

Thanks in advance,
msg145356 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-10-11 18:44
IIRC what I did was clone the repo, configure and build, then

sudo make frameworkinstall

For me (on Leopard), this installed Python 3.3 in /Library/Frameworks/Python.framework, leaving my system Python (2.5.1) alone. Then you can just invoke the regression tests using

python3.3 Lib/test/regrtest.py test_site

from the appropriate directory. But note that this is a case where the test needs fixing, not the code being tested.
msg145364 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-10-11 20:25
>   sudo make frameworkinstall

While that shouldn't affect the Apple-supplied system Pythons, be aware that with default ./configure settings this will overwrite any third-party Python installs (like from the python.org installers) of the version in question in /Library/Frameworks.  For unreleased versions, like from default that shouldn't be a big issue.  But it is safer and easy to pick some other location to install the framework.  I also usually use a different framework name to reduce the chances of accidentally dynamically linking to the wrong framework.  On a current 10.6 or 10.7 system, I'd recommend something like this:

./configure --enable-universalsdk=/Developer/SDKs/MacOSX10.6.sdk --with-universal-archs=intel '--prefix=/path/to/test/root' '--enable-framework=/path/to/test/Library' --with-framework-name=pytest_10_6 MACOSX_DEPLOYMENT_TARGET=10.6 CC=/usr/bin/gcc-4.2

On 10.4 or 10.5 systems, to simulate the 32-bit-only installer build:

./configure --enable-universalsdk=/Developer/SDKs/MacOSX10.4u.sdk --with-universal-archs=32-bit '--prefix=/path/to/test/root' '--enable-framework=/path/to/test/Library' --with-framework-name=pytest_10_3 --with-pydebug MACOSX_DEPLOYMENT_TARGET=10.3 CC=/usr/bin/gcc-4.0

Bryce, are you interested in writing a patch for the test?
msg145365 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-10-11 20:28
I forgot to mention that one advantage of using another framework and root location, say, under your home directory somewhere, is that it is unnecessary to use sudo.  And you don't need to use the special target in any case, simply "make install".
msg145788 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-10-18 09:26
On 11 Oct, 2011, at 22:28, Ned Deily wrote:

> 
> Ned Deily <nad@acm.org> added the comment:
> 
> I forgot to mention that one advantage of using another framework and root location, say, under your home directory somewhere, is that it is unnecessary to use sudo.  And you don't need to use the special target in any case, simply "make install".

Make install always works, the frameworkinstall target is a leftover from a time when you couldn't use "make install".
msg152712 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-02-06 00:00
New changeset 82c4f094f811 by Ned Deily in branch '2.7':
Issue #10881: Fix test_site failures with OS X framework builds.
http://hg.python.org/cpython/rev/82c4f094f811

New changeset 013cba2eb008 by Ned Deily in branch '3.2':
Issue #10881: Fix test_site failure with OS X framework builds.
http://hg.python.org/cpython/rev/013cba2eb008

New changeset c88606bd5287 by Ned Deily in branch 'default':
Issue #10881: merge
http://hg.python.org/cpython/rev/c88606bd5287
msg152713 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-02-06 00:06
Thanks, Vinay, for your analysis.  I adapted it for the applied fix.  For 2.7, there were two additional test_site failures that are fixed by back porting minor fixes to site.py and sysconfig.py from 3.x.  Applied in 2.7 (for 2.7.3), 3.2 (for 3.2.3), and default (for 3.3).
msg152716 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-02-06 00:57
P.S. I forgot to mention that one of the 2.7 test_site failures was due to the PYTHONUSERBASE env variable having no effect with OS X framework builds.  That had been fixed in 3.x; it's now back ported.
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55090
2012-02-06 00:57:38ned.deilysetmessages: + msg152716
2012-02-06 00:06:21ned.deilysetstatus: open -> closed
resolution: fixed
messages: + msg152713

stage: needs patch -> resolved
2012-02-06 00:00:44python-devsetnosy: + python-dev
messages: + msg152712
2011-10-18 09:26:32ronaldoussorensetfiles: + smime.p7s

messages: + msg145788
2011-10-11 20:28:31ned.deilysetmessages: + msg145365
2011-10-11 20:25:43ned.deilysetnosy: + ned.deily
messages: + msg145364

assignee: ronaldoussoren -> ned.deily
stage: patch review -> needs patch
2011-10-11 18:44:16vinay.sajipsetmessages: + msg145356
2011-10-11 18:15:27louisciphersetnosy: + louiscipher
messages: + msg145355
2011-07-22 21:43:52eric.araujosetkeywords: + patch, needs review
stage: needs patch -> patch review
2011-07-19 14:10:42vinay.sajipsetmessages: + msg140667
2011-07-19 13:12:22eric.araujosetkeywords: + easy

stage: needs patch
messages: + msg140664
versions: + Python 2.7, Python 3.3
2011-07-19 13:11:10eric.araujosetsuperseder: pep-0370 on osx duplicates existing functionality ->

messages: + msg140663
nosy: + eric.araujo
2011-07-19 11:29:05vinay.sajipsetstatus: closed -> open

nosy: + vinay.sajip
messages: + msg140655

type: behavior
resolution: duplicate -> (no value)
2011-01-10 21:49:17ixokaisetsuperseder: pep-0370 on osx duplicates existing functionality
2011-01-10 19:55:04ixokaisetstatus: open -> closed

messages: + msg125920
resolution: duplicate
2011-01-10 19:54:06ixokaicreate