Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 360259 - Stabilize dev-python/setproctitle-1.1.2
Summary: Stabilize dev-python/setproctitle-1.1.2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords: STABLEREQ
Depends on:
Blocks: 360203
  Show dependency tree
 
Reported: 2011-03-24 11:46 UTC by Agostino Sarubbo
Modified: 2011-04-10 06:50 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log failing tests on x86 (build.log,11.02 KB, text/plain)
2011-03-25 10:57 UTC, Andreas Schürch
Details
fixes the testsuite for default ansi. (setproctitle-1.1.1-ansi.patch,1.46 KB, text/plain)
2011-03-25 17:40 UTC, Andreas Schürch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2011-03-24 11:46:31 UTC
$summary

Needs for gunicorn stablereq
Comment 1 Markos Chandras (RETIRED) gentoo-dev 2011-03-24 11:49:57 UTC
amd64 done
Comment 2 Andreas Schürch gentoo-dev 2011-03-25 10:57:09 UTC
Created attachment 267179 [details]
build.log failing tests on x86

It fails on a test on my x86 install!?


Portage 2.1.9.42 (default/linux/x86/10.0, gcc-4.4.5, glibc-2.11.3-r0, 2.6.36-gentoo-r5 i686)
=================================================================                           
System uname: Linux-2.6.36-gentoo-r5-i686-QEMU_Virtual_CPU_version_0.13.0-with-gentoo-1.12.14
Timestamp of tree: Fri, 25 Mar 2011 07:30:01 +0000                                           
distcc 3.1 i686-pc-linux-gnu [disabled]                                                      
app-shells/bash:     4.1_p9                                                                  
dev-java/java-config: 2.1.11-r3                                                              
dev-lang/python:     2.6.6-r2, 3.1.3-r1                                                      
dev-util/cmake:      2.8.4                                                                   
sys-apps/baselayout: 1.12.14-r1                                                              
sys-apps/sandbox:    2.4                                                                     
sys-devel/autoconf:  2.13, 2.65-r1                                                           
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1                                                
sys-devel/binutils:  2.20.1-r1                                                               
sys-devel/gcc:       4.4.5                                                                   
sys-devel/gcc-config: 1.4.1                                                                  
sys-devel/libtool:   2.2.10                                                                  
sys-devel/make:      3.81-r2                                                                 
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)                                     
ACCEPT_KEYWORDS="x86"                                                                        
ACCEPT_LICENSE="*"                                                                           
CBUILD="i686-pc-linux-gnu"                                                                   
CFLAGS="-O2 -march=i686 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /home/mythtv/ /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=i686 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl assistant autoipd berkdb bzip2 cairo cli consolekit cracklib crypt cups cxx dbus dri extras fontconfig fortran ftp gd gdbm gpm gtk iconv icu ipv6 jpeg kde lcms modules mssql mudflap mysql mysqli ncurses nls nptl nptlonly objc ogg opengl openmp pam pcre perl png policykit postgres pppd python qt3support qt4 readline semantic-desktop session sql ssl svg sysfs tcpd threads tordns truetype unicode webkit x86 xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="cirrus vesa fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 3 Agostino Sarubbo gentoo-dev 2011-03-25 11:01:45 UTC
(In reply to comment #2)
> It fails on a test on my x86 install!?
same thing here
Comment 4 Johan Bergström 2011-03-25 11:27:29 UTC
Posted a bug about it upstream which usually is very responsive and helpful. Lets see what happens - http://code.google.com/p/py-setproctitle/issues/detail?id=13
Comment 5 Johan Bergström 2011-03-25 12:47:03 UTC
I'm unable to reproduce this on my x86 (or amd64). Could anyone that has this issue please run test more verbosely? Feedback from author at above issue on google code.
Comment 6 Daniele Varrazzo 2011-03-25 12:49:45 UTC
Hello, I'm "upstream"

I've tested on ubuntu and I couldn't reproduce the bug, neither with system Python 3.1.2 nor with 3.1.3 compiled from source.

The error happens at line 8 of the script in test_unicode(), meaning that what fails is:

    print os.popen("ps -o pid,command 2> /dev/null").read()

so it looks like the script is being run in a console with ascii encoding. Which is weird as a check in the test would have it skipped if the system encoding is not utf8.

I also see from your log that 2 tests are skipped: always on ubuntu with python 3.1 no test is skipped. Can you run the test more verbosely to show which are they?

As a reference, I usually run the tests with:

    make PYTHON=python3.1 PYCONFIG=python3.1-config test

to check Python3.1: nose is not required for it. Can you test this command to see why the other 2 tests are skipped? I suspect a file system encoding issue.
Comment 7 Daniele Varrazzo 2011-03-25 12:56:44 UTC
I had to cope with a similar issue on OSX but I don't have Py3 on that machine and I don't want to see it anymore :)

What is the output of sys.getfilesystemencoding() on the systems where the test fails?
Comment 8 Andreas Schürch gentoo-dev 2011-03-25 13:34:16 UTC
Hi Daniele, 

Thanks for looking at it! :-)

For the gentoo specifics: I haven't configured /etc/locale.gen, so all locales should be available... $LANG isn't set at all in the environment.

Python says:
sys.getdefaultencoding(): ascii


# make PYTHON=python3.1 PYCONFIG=python-config-3.1 test
mkdir -p py3                                                                     
mkdir -p py3/src                                                                 
mkdir -p py3/tests                                                               
for f in `cat MANIFEST`; do cp -v $f py3/$f; done                                
`COPYRIGHT' -> `py3/COPYRIGHT'                                                   
`HISTORY' -> `py3/HISTORY'                                                       
`MANIFEST' -> `py3/MANIFEST'                                                     
`Makefile' -> `py3/Makefile'                                                     
`README' -> `py3/README'                                                         
`setup.py' -> `py3/setup.py'                                                     
`src/c.h' -> `py3/src/c.h'                                                       
`src/setproctitle.c' -> `py3/src/setproctitle.c'                                 
`src/spt.h' -> `py3/src/spt.h'                                                   
`src/spt_config.h' -> `py3/src/spt_config.h'                                     
`src/spt_debug.c' -> `py3/src/spt_debug.c'                                       
`src/spt_python.h' -> `py3/src/spt_python.h'                                     
`src/spt_setup.c' -> `py3/src/spt_setup.c'                                       
`src/spt_setup.h' -> `py3/src/spt_setup.h'                                       
`src/spt_status.c' -> `py3/src/spt_status.c'                                     
`src/spt_status.h' -> `py3/src/spt_status.h'                                     
`src/strlcpy.c' -> `py3/src/strlcpy.c'                                           
`tests/pyrun.c' -> `py3/tests/pyrun.c'                                           
`tests/setproctitle_test.py' -> `py3/tests/setproctitle_test.py'                 
# setup.py should be executable with python3 as distribute                       
# currenlty doesn't seem to try to convert it                                    
2to3 -w --no-diffs py3/tests                                                     
RefactoringTool: Skipping implicit fixer: buffer                                 
RefactoringTool: Skipping implicit fixer: idioms                                 
RefactoringTool: Skipping implicit fixer: set_literal                            
RefactoringTool: Skipping implicit fixer: ws_comma                               
RefactoringTool: Refactored py3/tests/setproctitle_test.py                       
RefactoringTool: Files that were modified:                                       
RefactoringTool: py3/tests/setproctitle_test.py                                  
python3.1 py3/setup.py build --build-lib build/lib.3                             
running build                                                                    
running build_ext                                                                
PYTHONPATH=build/lib.3:$PYTHONPATH \                                             
        ROOT_PATH=/var/tmp/portage/dev-python/setproctitle-1.1.1/work/setproctitle-1.1.1 \
        python3.1 py3/tests/setproctitle_test.py -v                                       
test_embedded (__main__.SetproctitleTestCase)                                             
Check the module doesn't explode with embedded Python. ... b''                            
b'Traceback (most recent call last):\n  File "stdin", line 1, in <module>\nImportError: dynamic module does not define init function (initsetproctitle)\n'
FAIL                                                                                                                                                      
test_environ (__main__.SetproctitleTestCase)                                                                                                              
Check that clobbering environ didn't break env. ... ok                                                                                                    
test_getproctitle (__main__.SetproctitleTestCase)                                                                                                         
getproctitle() can read the process title back. ... ok                                                                                                    
test_init_getproctitle (__main__.SetproctitleTestCase)                                                                                                    
getproctitle() returns a sensible value at initial call. ... ok                                                                                           
test_issue_8 (__main__.SetproctitleTestCase)                                                                                                              
Test that the module works with 'python -m'. ... ok                                                                                                       
test_prctl (__main__.SetproctitleTestCase)                                                                                                                
Check that prctl is called on supported platforms. ... ok                                                                                                 
test_runner (__main__.SetproctitleTestCase)                                                                                                               
Test the script execution method. ... ok                                                                                                                  
test_setproctitle (__main__.SetproctitleTestCase)                                                                                                         
setproctitle() can set the process title, duh. ... ok                                                                                                     
test_unicode (__main__.SetproctitleTestCase)                                                                                                              
Title can contain unicode characters. ... b'18373\n'                                                                                                      
b'Traceback (most recent call last):\n  File "<stdin>", line 8, in <module>\n  File "/usr/lib/python3.1/encodings/ascii.py", line 26, in decode\n    return codecs.ascii_decode(input, self.errors)[0]\nUnicodeDecodeError: \'ascii\' codec can\'t decode byte 0xe2 in position 149: ordinal not in range(128)\n'                                                                                                                                                                                   
FAIL                                                                                                                                                                                                                                              
test_weird_args (__main__.SetproctitleTestCase)                                                                                                                                                                                                   
No problem with encoded arguments. ... ERROR                                                                                                                                                                                                      
test_weird_path (__main__.SetproctitleTestCase)                                                                                                                                                                                                   
No problem with encoded argv[0] path. ... ERROR                                                                                                                                                                                                   

======================================================================
ERROR: test_weird_args (__main__.SetproctitleTestCase)                
No problem with encoded arguments.                                    
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "py3/tests/setproctitle_test.py", line 207, in test_weird_args 
    """, args=" ".join(["-", "hello", euro, snowman]))                
  File "py3/tests/setproctitle_test.py", line 290, in run_script      
    shell=True, close_fds=True)                                       
  File "/usr/lib/python3.1/subprocess.py", line 646, in __init__      
    errread, errwrite)                                                
  File "/usr/lib/python3.1/subprocess.py", line 1157, in _execute_child
    raise child_exception                                              
TypeError: execv() arg 2 must contain only strings                     

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 210, in test_weird_args
    "apparently we can't pass unicode args to a program")            
nose.plugins.skip.SkipTest: apparently we can't pass unicode args to a program

======================================================================
ERROR: test_weird_path (__main__.SetproctitleTestCase)                
No problem with encoded argv[0] path.                                 
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "py3/tests/setproctitle_test.py", line 228, in test_weird_path
    os.makedirs(dir)
  File "/usr/lib/python3.1/os.py", line 134, in makedirs
    if head and tail and not path.exists(head):
  File "/usr/lib/python3.1/genericpath.py", line 18, in exists
    st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\u20ac' in position 15: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 230, in test_weird_path
    raise SkipTest("file system doesn't support unicode")
nose.plugins.skip.SkipTest: file system doesn't support unicode

======================================================================
FAIL: test_embedded (__main__.SetproctitleTestCase)
Check the module doesn't explode with embedded Python.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 273, in test_embedded
    executable=exe)
  File "py3/tests/setproctitle_test.py", line 302, in run_script
    self.fail("test script failed")
AssertionError: test script failed

======================================================================
FAIL: test_unicode (__main__.SetproctitleTestCase)
Title can contain unicode characters.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 178, in test_unicode
    """)
  File "py3/tests/setproctitle_test.py", line 302, in run_script
    self.fail("test script failed")
AssertionError: test script failed

----------------------------------------------------------------------
Ran 11 tests in 3.068s

FAILED (failures=2, errors=2)
make: *** [test] Error 1
Comment 9 Daniele Varrazzo 2011-03-25 14:22:09 UTC
(In reply to comment #8)

> Python says:
> sys.getdefaultencoding(): ascii

What is sys.getfilesystemencoding()?
               ^^^^^^^^^^

I suspect the problem is similar to this: http://code.google.com/p/py-setproctitle/source/detail?r=27bd60cd4e4aa605297e2aa0ef83941fac48013b#

> # make PYTHON=python3.1 PYCONFIG=python-config-3.1 test
...
> FAILED (failures=2, errors=2)
> make: *** [test] Error 1

More than I was expecting :\


> test_embedded (__main__.SetproctitleTestCase)                                   
> Check the module doesn't explode with embedded Python. ... b''                  
> b'Traceback (most recent call last):\n  File "stdin", line 1, in
> <module>\nImportError: dynamic module does not define init function
> (initsetproctitle)\n'

This is likely to be a library problem compiling the program 'tests/pyrun'. I've just committed a change to work more easily with python in a non-standard directory.


(__main__.SetproctitleTestCase)                                    
> Title can contain unicode characters. ... b'18373\n'                            
> b'Traceback (most recent call last):\n  File "<stdin>", line 8, in <module>\n 
> File "/usr/lib/python3.1/encodings/ascii.py", line 26, in decode\n    return
> codecs.ascii_decode(input, self.errors)[0]\nUnicodeDecodeError: \'ascii\' codec
> can\'t decode byte 0xe2 in position 149: ordinal not in range(128)\n'           
> FAIL                                                                            

This is our man: I expect the test can't be run if getfilesystemencoding() is not utf8.


> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "py3/tests/setproctitle_test.py", line 210, in test_weird_args
>     "apparently we can't pass unicode args to a program")            
> nose.plugins.skip.SkipTest: apparently we can't pass unicode args to a program

Looks like there is a bad interaction between the SkipTest in nose and the one in the stdlib. I suppose this patch should be applied:

--- a/tests/setproctitle_test.py
+++ b/tests/setproctitle_test.py
@@ -16,10 +16,10 @@
 IS_PY3K = sys.version_info[0] == 3
 
 try:
-    from nose.plugins.skip import SkipTest
+    from unittest import SkipTest
 except ImportError:
     try:
-        from unittest import SkipTest
+        from nose.plugins.skip import SkipTest
     except ImportError:
         class SkipTest(Exception):
             pass

But I want to test it more carefully with python 2.7.
Comment 10 Andreas Schürch gentoo-dev 2011-03-25 14:53:43 UTC
(In reply to comment #9)

> What is sys.getfilesystemencoding()?
>                ^^^^^^^^^^
Ah sorry! it is: ANSI_X3.4-1968

I did another run with you suggested two modified lines...

# make PYTHON=python3.1 PYCONFIG=python-config-3.1 test
mkdir -p py3                                                                     
mkdir -p py3/src                                                                 
mkdir -p py3/tests                                                               
for f in `cat MANIFEST`; do cp -v $f py3/$f; done                                
`COPYRIGHT' -> `py3/COPYRIGHT'                                                   
`HISTORY' -> `py3/HISTORY'                                                       
`MANIFEST' -> `py3/MANIFEST'                                                     
`Makefile' -> `py3/Makefile'                                                     
`README' -> `py3/README'                                                         
`setup.py' -> `py3/setup.py'                                                     
`src/c.h' -> `py3/src/c.h'                                                       
`src/setproctitle.c' -> `py3/src/setproctitle.c'                                 
`src/spt.h' -> `py3/src/spt.h'                                                   
`src/spt_config.h' -> `py3/src/spt_config.h'                                     
`src/spt_debug.c' -> `py3/src/spt_debug.c'                                       
`src/spt_python.h' -> `py3/src/spt_python.h'                                     
`src/spt_setup.c' -> `py3/src/spt_setup.c'                                       
`src/spt_setup.h' -> `py3/src/spt_setup.h'                                       
`src/spt_status.c' -> `py3/src/spt_status.c'                                     
`src/spt_status.h' -> `py3/src/spt_status.h'                                     
`src/strlcpy.c' -> `py3/src/strlcpy.c'                                           
`tests/pyrun.c' -> `py3/tests/pyrun.c'                                           
`tests/setproctitle_test.py' -> `py3/tests/setproctitle_test.py'                 
# setup.py should be executable with python3 as distribute                       
# currenlty doesn't seem to try to convert it                                    
2to3 -w --no-diffs py3/tests                                                     
RefactoringTool: Skipping implicit fixer: buffer                                 
RefactoringTool: Skipping implicit fixer: idioms                                 
RefactoringTool: Skipping implicit fixer: set_literal                            
RefactoringTool: Skipping implicit fixer: ws_comma                               
RefactoringTool: Refactored py3/tests/setproctitle_test.py                       
RefactoringTool: Files that were modified:                                       
RefactoringTool: py3/tests/setproctitle_test.py                                  
python3.1 py3/setup.py build --build-lib build/lib.3                             
running build                                                                    
running build_ext                                                                
PYTHONPATH=build/lib.3:$PYTHONPATH \                                             
        ROOT_PATH=/var/tmp/portage/dev-python/setproctitle-1.1.1/work/setproctitle-1.1.1 \
        python3.1 py3/tests/setproctitle_test.py -v                                       
test_embedded (__main__.SetproctitleTestCase)                                             
Check the module doesn't explode with embedded Python. ... b''                            
b'Traceback (most recent call last):\n  File "stdin", line 1, in <module>\nImportError: dynamic module does not define init function (initsetproctitle)\n'
FAIL                                                                                                                                                      
test_environ (__main__.SetproctitleTestCase)                                                                                                              
Check that clobbering environ didn't break env. ... ok                                                                                                    
test_getproctitle (__main__.SetproctitleTestCase)                                                                                                         
getproctitle() can read the process title back. ... ok                                                                                                    
test_init_getproctitle (__main__.SetproctitleTestCase)                                                                                                    
getproctitle() returns a sensible value at initial call. ... ok                                                                                           
test_issue_8 (__main__.SetproctitleTestCase)                                                                                                              
Test that the module works with 'python -m'. ... ok                                                                                                       
test_prctl (__main__.SetproctitleTestCase)                                                                                                                
Check that prctl is called on supported platforms. ... ok                                                                                                 
test_runner (__main__.SetproctitleTestCase)                                                                                                               
Test the script execution method. ... ok
test_setproctitle (__main__.SetproctitleTestCase)
setproctitle() can set the process title, duh. ... ok
test_unicode (__main__.SetproctitleTestCase)
Title can contain unicode characters. ... b'18457\n'
b'Traceback (most recent call last):\n  File "<stdin>", line 8, in <module>\n  File "/usr/lib/python3.1/encodings/ascii.py", line 26, in decode\n    return codecs.ascii_decode(input, self.errors)[0]\nUnicodeDecodeError: \'ascii\' codec can\'t decode byte 0xe2 in position 149: ordinal not in range(128)\n'
FAIL
test_weird_args (__main__.SetproctitleTestCase)
No problem with encoded arguments. ... skipped "apparently we can't pass unicode args to a program"
test_weird_path (__main__.SetproctitleTestCase)
No problem with encoded argv[0] path. ... skipped "file system doesn't support unicode"

======================================================================
FAIL: test_embedded (__main__.SetproctitleTestCase)
Check the module doesn't explode with embedded Python.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 273, in test_embedded
    executable=exe)
  File "py3/tests/setproctitle_test.py", line 302, in run_script
    self.fail("test script failed")
AssertionError: test script failed

======================================================================
FAIL: test_unicode (__main__.SetproctitleTestCase)
Title can contain unicode characters.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 178, in test_unicode
    """)
  File "py3/tests/setproctitle_test.py", line 302, in run_script
    self.fail("test script failed")
AssertionError: test script failed

----------------------------------------------------------------------
Ran 11 tests in 3.091s

FAILED (failures=2, skipped=2)
make: *** [test] Error 1
Comment 11 Daniele Varrazzo 2011-03-25 15:32:42 UTC
(In reply to comment #10)
> (In reply to comment #9)
> 
> > What is sys.getfilesystemencoding()?
> >                ^^^^^^^^^^
> Ah sorry! it is: ANSI_X3.4-1968

Lol! This IS a fancy way to say "ascii" :)

I think the test can't be executed in this condition: I'm for skipping it.

--- a/tests/setproctitle_test.py
+++ b/tests/setproctitle_test.py
@@ -162,10 +162,19 @@
 
     def test_unicode(self):
         """Title can contain unicode characters."""
-        if 'utf-8' != sys.getdefaultencoding():
-            raise SkipTest("encoding '%s' can't deal with snowmen"
+        snowman = u'\u2603'
+        try:
+            snowman.encode(sys.getdefaultencoding())
+        except UnicodeEncodeError:
+            raise SkipTest("default encoding '%s' can't deal with snowmen"
                     % sys.getdefaultencoding())
 
+        try:
+            snowman.encode(sys.getfilesystemencoding())
+        except UnicodeEncodeError:
+            raise SkipTest("file system encoding '%s' can't deal with snowmen"
+                    % sys.getfilesystemencoding())
+
         rv = self.run_script(r"""
             snowman = u'\u2603'
 

> I did another run with you suggested two modified lines...

...and the two failures are correctly reported as skips. Thanks, I think I will commit it too if it doesn't mess up the Py2 side.

Still I'm not getting why the test wasn't skipped before: the check "if 'utf-8' != sys.getdefaultencoding():" was already there and your default encoding was 'ascii'.
Comment 12 Andreas Schürch gentoo-dev 2011-03-25 16:05:00 UTC
Seems we are getting a bit closer! :-)
The second run is with python 2.6.6 btw!
Thanks you so far and sorry audience for the bugspam! :-)

# make PYTHON=python3.1 PYCONFIG=python-config-3.1 test
mkdir -p py3
mkdir -p py3/src
mkdir -p py3/tests
for f in `cat MANIFEST`; do cp -v $f py3/$f; done
`COPYRIGHT' -> `py3/COPYRIGHT'
`HISTORY' -> `py3/HISTORY'
`MANIFEST' -> `py3/MANIFEST'
`Makefile' -> `py3/Makefile'
`README' -> `py3/README'
`setup.py' -> `py3/setup.py'
`src/c.h' -> `py3/src/c.h'
`src/setproctitle.c' -> `py3/src/setproctitle.c'
`src/spt.h' -> `py3/src/spt.h'
`src/spt_config.h' -> `py3/src/spt_config.h'
`src/spt_debug.c' -> `py3/src/spt_debug.c'
`src/spt_python.h' -> `py3/src/spt_python.h'
`src/spt_setup.c' -> `py3/src/spt_setup.c'
`src/spt_setup.h' -> `py3/src/spt_setup.h'
`src/spt_status.c' -> `py3/src/spt_status.c'
`src/spt_status.h' -> `py3/src/spt_status.h'
`src/strlcpy.c' -> `py3/src/strlcpy.c'
`tests/pyrun.c' -> `py3/tests/pyrun.c'
`tests/setproctitle_test.py' -> `py3/tests/setproctitle_test.py'
# setup.py should be executable with python3 as distribute
# currenlty doesn't seem to try to convert it
2to3 -w --no-diffs py3/tests
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored py3/tests/setproctitle_test.py
RefactoringTool: Files that were modified:
RefactoringTool: py3/tests/setproctitle_test.py
python3.1 py3/setup.py build --build-lib build/lib.3
running build
running build_ext
PYTHONPATH=build/lib.3:$PYTHONPATH \
        ROOT_PATH=/var/tmp/portage/dev-python/setproctitle-1.1.1/work/setproctitle-1.1.1 \
        python3.1 py3/tests/setproctitle_test.py -v
test_embedded (__main__.SetproctitleTestCase)
Check the module doesn't explode with embedded Python. ... b''
b'Traceback (most recent call last):\n  File "stdin", line 1, in <module>\nImportError: dynamic module does not define init function (initsetproctitle)\n'
FAIL
test_environ (__main__.SetproctitleTestCase)
Check that clobbering environ didn't break env. ... ok
test_getproctitle (__main__.SetproctitleTestCase)
getproctitle() can read the process title back. ... ok
test_init_getproctitle (__main__.SetproctitleTestCase)
getproctitle() returns a sensible value at initial call. ... ok
test_issue_8 (__main__.SetproctitleTestCase)
Test that the module works with 'python -m'. ... ok
test_prctl (__main__.SetproctitleTestCase)
Check that prctl is called on supported platforms. ... ok
test_runner (__main__.SetproctitleTestCase)
Test the script execution method. ... ok
test_setproctitle (__main__.SetproctitleTestCase)
setproctitle() can set the process title, duh. ... ok
test_unicode (__main__.SetproctitleTestCase)
Title can contain unicode characters. ... skipped "file system encoding 'ascii' can't deal with snowmen"
test_weird_args (__main__.SetproctitleTestCase)
No problem with encoded arguments. ... skipped "apparently we can't pass unicode args to a program"
test_weird_path (__main__.SetproctitleTestCase)
No problem with encoded argv[0] path. ... skipped "file system doesn't support unicode"

======================================================================
FAIL: test_embedded (__main__.SetproctitleTestCase)
Check the module doesn't explode with embedded Python.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 281, in test_embedded
    executable=exe)
  File "py3/tests/setproctitle_test.py", line 310, in run_script
    self.fail("test script failed")
AssertionError: test script failed

----------------------------------------------------------------------
Ran 11 tests in 2.679s

FAILED (failures=1, skipped=3)
make: *** [test] Error 1



-------------------------------------------------2. run
archer setproctitle-1.1.1 # make test     
python setup.py build --build-lib build/lib.2
running build
running build_ext
PYTHONPATH=`pwd`/build/lib.2:$PYTHONPATH \
        ROOT_PATH=/var/tmp/portage/dev-python/setproctitle-1.1.1/work/setproctitle-1.1.1 \
        python `which nosetests` -v -s -w tests
Check the module doesn't explode with embedded Python. ... ok
Check that clobbering environ didn't break env. ... ok
getproctitle() can read the process title back. ... ok
getproctitle() returns a sensible value at initial call. ... ok
Test that the module works with 'python -m'. ... ok
Check that prctl is called on supported platforms. ... ok
Test the script execution method. ... ok
setproctitle() can set the process title, duh. ... ok
Title can contain unicode characters. ... ERROR
No problem with encoded arguments. ... ERROR
No problem with encoded argv[0] path. ... ERROR

======================================================================
ERROR: Title can contain unicode characters.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/setproctitle-1.1.1/work/setproctitle-1.1.1/tests/setproctitle_test.py", line 170, in test_unicode
    % sys.getdefaultencoding())
SkipTest: default encoding 'ascii' can't deal with snowmen

======================================================================
ERROR: No problem with encoded arguments.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/setproctitle-1.1.1/work/setproctitle-1.1.1/tests/setproctitle_test.py", line 218, in test_weird_args
    "apparently we can't pass unicode args to a program")
SkipTest: apparently we can't pass unicode args to a program

======================================================================
ERROR: No problem with encoded argv[0] path.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/setproctitle-1.1.1/work/setproctitle-1.1.1/tests/setproctitle_test.py", line 238, in test_weird_path
    raise SkipTest("file system doesn't support unicode")
SkipTest: file system doesn't support unicode

----------------------------------------------------------------------
Ran 11 tests in 0.157s

FAILED (errors=3)
make: *** [test] Error 1
Comment 13 Daniele Varrazzo 2011-03-25 16:15:13 UTC
(In reply to comment #12)
> Seems we are getting a bit closer! :-)
> The second run is with python 2.6.6 btw!
> Thanks you so far and sorry audience for the bugspam! :-)

> Check the module doesn't explode with embedded Python. ... b''
> b'Traceback (most recent call last):\n  File "stdin", line 1, in
> <module>\nImportError: dynamic module does not define init function
> (initsetproctitle)\n'
> FAIL

This is a problem you are having compiling/linking 'tests/pyrun', or runnung it with Py3 after having compiled it with Py2. "make clean" should help. It is not part of the original bug report: I'd leave it off.


> SkipTest: default encoding 'ascii' can't deal with snowmen
> SkipTest: apparently we can't pass unicode args to a program
> SkipTest: file system doesn't support unicode

These are tests skipped, but with Python 2.6 and without nose installed SkipTest is not available, so I just make an exception and throw it, thus tests skips are reported as failures.

From what I see here the original failure would be solved by the patch in comment #11. I will try to release a version 1.1.2 including it soon.
Comment 14 Andreas Schürch gentoo-dev 2011-03-25 16:31:07 UTC
After a fresh recompile and adding the patch in comment 11 i get the following:


# make PYTHON=python3.1 PYCONFIG=python-config-3.1 test
mkdir -p py3
mkdir -p py3/src
mkdir -p py3/tests
for f in `cat MANIFEST`; do cp -v $f py3/$f; done
`COPYRIGHT' -> `py3/COPYRIGHT'
`HISTORY' -> `py3/HISTORY'
`MANIFEST' -> `py3/MANIFEST'
`Makefile' -> `py3/Makefile'
`README' -> `py3/README'
`setup.py' -> `py3/setup.py'
`src/c.h' -> `py3/src/c.h'
`src/setproctitle.c' -> `py3/src/setproctitle.c'
`src/spt.h' -> `py3/src/spt.h'
`src/spt_config.h' -> `py3/src/spt_config.h'
`src/spt_debug.c' -> `py3/src/spt_debug.c'
`src/spt_python.h' -> `py3/src/spt_python.h'
`src/spt_setup.c' -> `py3/src/spt_setup.c'
`src/spt_setup.h' -> `py3/src/spt_setup.h'
`src/spt_status.c' -> `py3/src/spt_status.c'
`src/spt_status.h' -> `py3/src/spt_status.h'
`src/strlcpy.c' -> `py3/src/strlcpy.c'
`tests/pyrun.c' -> `py3/tests/pyrun.c'
`tests/setproctitle_test.py' -> `py3/tests/setproctitle_test.py'
# setup.py should be executable with python3 as distribute
# currenlty doesn't seem to try to convert it
2to3 -w --no-diffs py3/tests
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored py3/tests/setproctitle_test.py
RefactoringTool: Files that were modified:
RefactoringTool: py3/tests/setproctitle_test.py
python3.1 py3/setup.py build --build-lib build/lib.3
running build
running build_ext
building 'setproctitle' extension
creating build
creating build/temp.linux-i686-3.1
creating build/temp.linux-i686-3.1/src
i686-pc-linux-gnu-gcc -pthread -fPIC -DHAVE_SYS_PRCTL_H=1 -DSPT_VERSION=1.1.1 -I/usr/include/python3.1 -c src/setproctitle.c -o build/temp.linux-i686-3.1/src/setproctitle.o
i686-pc-linux-gnu-gcc -pthread -fPIC -DHAVE_SYS_PRCTL_H=1 -DSPT_VERSION=1.1.1 -I/usr/include/python3.1 -c src/spt_debug.c -o build/temp.linux-i686-3.1/src/spt_debug.o
i686-pc-linux-gnu-gcc -pthread -fPIC -DHAVE_SYS_PRCTL_H=1 -DSPT_VERSION=1.1.1 -I/usr/include/python3.1 -c src/spt_setup.c -o build/temp.linux-i686-3.1/src/spt_setup.o
i686-pc-linux-gnu-gcc -pthread -fPIC -DHAVE_SYS_PRCTL_H=1 -DSPT_VERSION=1.1.1 -I/usr/include/python3.1 -c src/spt_status.c -o build/temp.linux-i686-3.1/src/spt_status.o
i686-pc-linux-gnu-gcc -pthread -fPIC -DHAVE_SYS_PRCTL_H=1 -DSPT_VERSION=1.1.1 -I/usr/include/python3.1 -c src/strlcpy.c -o build/temp.linux-i686-3.1/src/strlcpy.o
creating build/lib.3
i686-pc-linux-gnu-gcc -pthread -shared build/temp.linux-i686-3.1/src/setproctitle.o build/temp.linux-i686-3.1/src/spt_debug.o build/temp.linux-i686-3.1/src/spt_setup.o build/temp.linux-i686-3.1/src/spt_status.o build/temp.linux-i686-3.1/src/strlcpy.o -L/usr/lib -lpython3.1 -o build/lib.3/setproctitle.so
cc -I/usr/include/python3.1 -I/usr/include/python3.1 -lpthread -ldl -lutil -lm -lpython3.1 -o tests/pyrun tests/pyrun.c
PYTHONPATH=build/lib.3:$PYTHONPATH \
        ROOT_PATH=/var/tmp/portage/dev-python/setproctitle-1.1.1/work/setproctitle-1.1.1 \
        python3.1 py3/tests/setproctitle_test.py -v
test_embedded (__main__.SetproctitleTestCase)
Check the module doesn't explode with embedded Python. ... ok
test_environ (__main__.SetproctitleTestCase)
Check that clobbering environ didn't break env. ... ok
test_getproctitle (__main__.SetproctitleTestCase)
getproctitle() can read the process title back. ... ok
test_init_getproctitle (__main__.SetproctitleTestCase)
getproctitle() returns a sensible value at initial call. ... ok
test_issue_8 (__main__.SetproctitleTestCase)
Test that the module works with 'python -m'. ... ok
test_prctl (__main__.SetproctitleTestCase)
Check that prctl is called on supported platforms. ... ok
test_runner (__main__.SetproctitleTestCase)
Test the script execution method. ... ok
test_setproctitle (__main__.SetproctitleTestCase)
setproctitle() can set the process title, duh. ... ok
test_unicode (__main__.SetproctitleTestCase)
Title can contain unicode characters. ... ERROR
test_weird_args (__main__.SetproctitleTestCase)
No problem with encoded arguments. ... ERROR
test_weird_path (__main__.SetproctitleTestCase)
No problem with encoded argv[0] path. ... ERROR

======================================================================
ERROR: test_unicode (__main__.SetproctitleTestCase)
Title can contain unicode characters.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 172, in test_unicode
    snowman.encode(sys.getfilesystemencoding())
UnicodeEncodeError: 'ascii' codec can't encode character '\u2603' in position 0: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 175, in test_unicode
    % sys.getfilesystemencoding())
nose.plugins.skip.SkipTest: file system encoding 'ascii' can't deal with snowmen

======================================================================
ERROR: test_weird_args (__main__.SetproctitleTestCase)
No problem with encoded arguments.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 215, in test_weird_args
    """, args=" ".join(["-", "hello", euro, snowman]))
  File "py3/tests/setproctitle_test.py", line 298, in run_script
    shell=True, close_fds=True)
  File "/usr/lib/python3.1/subprocess.py", line 646, in __init__
    errread, errwrite)
  File "/usr/lib/python3.1/subprocess.py", line 1157, in _execute_child
    raise child_exception
TypeError: execv() arg 2 must contain only strings

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 218, in test_weird_args
    "apparently we can't pass unicode args to a program")
nose.plugins.skip.SkipTest: apparently we can't pass unicode args to a program

======================================================================
ERROR: test_weird_path (__main__.SetproctitleTestCase)
No problem with encoded argv[0] path.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 236, in test_weird_path
    os.makedirs(dir)
  File "/usr/lib/python3.1/os.py", line 134, in makedirs
    if head and tail and not path.exists(head):
  File "/usr/lib/python3.1/genericpath.py", line 18, in exists
    st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\u20ac' in position 15: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "py3/tests/setproctitle_test.py", line 238, in test_weird_path
    raise SkipTest("file system doesn't support unicode")
nose.plugins.skip.SkipTest: file system doesn't support unicode

----------------------------------------------------------------------
Ran 11 tests in 2.920s

FAILED (errors=3)
make: *** [test] Error 1
Comment 15 Daniele Varrazzo 2011-03-25 16:37:51 UTC
(In reply to comment #14)
> After a fresh recompile and adding the patch in comment 11 i get the following:

...
> nose.plugins.skip.SkipTest: file system doesn't support unicode

> FAILED (errors=3)
> make: *** [test] Error 1

Seems good: there is only nose.plugins.skip.SkipTest messing up with the stdlib unittest. Isn't the patch in comment #9 applied? You had it in comment #10.
Comment 16 Andreas Schürch gentoo-dev 2011-03-25 17:01:14 UTC
Ah bingo! :-)
...i forgot it after the fresh install...

Thank you very much for you patience! :-)
Comment 17 Andreas Schürch gentoo-dev 2011-03-25 17:40:18 UTC
Created attachment 267201 [details]
fixes the testsuite for default ansi.

This works for me! :-)
Thanks all!

--- /usr/portage/dev-python/setproctitle/setproctitle-1.1.1.ebuild      2011-03-24 13:01:10.000000000 +0100
+++ /root/setproctitle/setproctitle-1.1.1.ebuild        2011-03-25 18:30:24.000000000 +0100
@@ -7,7 +7,7 @@
 RESTRICT_PYTHON_ABIS="*-jython"
 DISTUTILS_SRC_TEST="nosetests"
 
-inherit distutils toolchain-funcs
+inherit distutils toolchain-funcs eutils
 
 DESCRIPTION="Allow customization of the process title."
 HOMEPAGE="http://code.google.com/p/py-setproctitle/ http://pypi.python.org/pypi/setproctitle"
@@ -25,6 +25,7 @@
 DOCS="HISTORY README"
 
 src_prepare() {
+       epatch "${FILESDIR}/${P}-ansi.patch"
        python_copy_sources
 
        conversion() {
Comment 18 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2011-03-26 18:30:38 UTC
Stabilize dev-python/setproctitle-1.1.2.
Comment 19 Daniele Varrazzo 2011-03-26 19:14:04 UTC
(In reply to comment #18)
> Stabilize dev-python/setproctitle-1.1.2.

LOL! Less than 30 minutes after the release, and before FreshMeat even noticed it :)

Gentoo rocks! Cheers!
Comment 20 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2011-03-26 19:28:06 UTC
(In reply to comment #19)

I noticed the release on http://pypi.python.org/pypi :) .
Comment 21 Agostino Sarubbo gentoo-dev 2011-03-26 19:37:08 UTC
pass test...amd64 ok
Comment 22 David Abbott (RETIRED) gentoo-dev 2011-03-26 19:47:43 UTC
Arch tested on x86, all good here ...
Comment 23 Christoph Mende (RETIRED) gentoo-dev 2011-03-26 20:09:26 UTC
amd64 done, thanks Agostino
Comment 24 Andreas Schürch gentoo-dev 2011-03-28 14:42:05 UTC
(In reply to comment #22)
> Arch tested on x86, all good here ...

+1 :-)
Comment 25 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2011-04-10 06:50:29 UTC
x86 stable, thanks David and Andreas