[pypy-svn] r42801 - in pypy/dist/pypy: . module/posix/test
afa at codespeak.net
afa at codespeak.net
Mon May 7 16:02:03 CEST 2007
Author: afa
Date: Mon May 7 16:02:03 2007
New Revision: 42801
Modified:
pypy/dist/pypy/conftest.py
pypy/dist/pypy/module/posix/test/test_posix2.py
Log:
Correct some tests in posix module:
- updates for win32
- test_environ was empty. Re-add code deleted in rev31440,
and correctly call space.startup() in all applevel tests.
There were many other tests deleted by rev 31440. Will try to re-add them later.
The missing startup() might be the reason why some socket/select tests fail on the win32 testbot:
Error messages seem to imply that WSAStartup() was not called.
It doesnt fail on my machines because "import socket" at the CPython level has the same effect.
Does the testbot run applevel tests in a separate process?
Modified: pypy/dist/pypy/conftest.py
==============================================================================
--- pypy/dist/pypy/conftest.py (original)
+++ pypy/dist/pypy/conftest.py Mon May 7 16:02:03 2007
@@ -59,6 +59,7 @@
traceback.print_exc()
py.test.fail("fatal: cannot initialize objspace: %r" %
(config.objspace.name,))
+ space.startup() # Initialize all builtin modules
space.setitem(space.builtin.w_dict, space.wrap('AssertionError'),
appsupport.build_pytest_assertion(space))
space.setitem(space.builtin.w_dict, space.wrap('raises'),
Modified: pypy/dist/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/dist/pypy/module/posix/test/test_posix2.py (original)
+++ pypy/dist/pypy/module/posix/test/test_posix2.py Mon May 7 16:02:03 2007
@@ -105,7 +105,9 @@
assert posix.access(pdir, posix.R_OK)
assert posix.access(pdir, posix.W_OK)
- assert not posix.access(pdir, posix.X_OK)
+ import sys
+ if sys.platform != "win32":
+ assert not posix.access(pdir, posix.X_OK)
def test_strerror(self):
@@ -123,9 +125,11 @@
# XXX check status1
pass # <- please, inspect.getsource(), don't crash
- if hasattr(__import__(os.name), "execv"): # and fork
+ if hasattr(__import__(os.name), "execv"):
def test_execv(self):
os = self.posix
+ if not hasattr(os, "fork"):
+ skip("Need fork() to test execv()")
pid = os.fork()
if pid == 0:
os.execv("/usr/bin/env", ["env", "python", "-c", "open('onefile', 'w').write('1')"])
@@ -138,7 +142,7 @@
raises(OSError, 'os.execv("saddsadsadsadsa", ["saddsadsasaddsa"])')
def test_execve(self):
- skip("not implemented")
+ skip("Not implemented")
os = self.posix
pid = os.fork()
if pid == 0:
@@ -161,9 +165,14 @@
cls.w_posix = space.appexec([], "(): import %s as m ; return m" % os.name)
cls.w_os = space.appexec([], "(): import os; return os")
cls.w_path = space.wrap(str(path))
+
def test_environ(self):
posix = self.posix
os = self.os
+ assert posix.environ['PATH']
+ del posix.environ['PATH']
+ def fn(): posix.environ['PATH']
+ raises(KeyError, fn)
if hasattr(__import__(os.name), "unsetenv"):
def test_unsetenv_nonexisting(self):
More information about the pypy-svn
mailing list