[pypy-commit] pypy release-2.2.x: Add an app-level-only test for os.startfile()
arigo
noreply at buildbot.pypy.org
Tue Nov 12 14:24:30 CET 2013
Author: Armin Rigo <arigo at tunes.org>
Branch: release-2.2.x
Changeset: r67978:2cec7296d7fb
Date: 2013-11-12 14:23 +0100
http://bitbucket.org/pypy/pypy/changeset/2cec7296d7fb/
Log: Add an app-level-only test for os.startfile()
diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -52,6 +52,7 @@
def setup_class(cls):
cls.space = space
+ cls.w_runappdirect = space.wrap(cls.runappdirect)
cls.w_posix = space.appexec([], GET_POSIX)
cls.w_path = space.wrap(str(path))
cls.w_path2 = space.wrap(str(path2))
@@ -1108,6 +1109,28 @@
assert False, "urandom() always returns the same string"
# Or very unlucky
+ if hasattr(os, 'startfile'):
+ def test_startfile(self):
+ if not self.runappdirect:
+ skip("should not try to import cffi at app-level")
+ startfile = self.posix.startfile
+ for t1 in [str, unicode]:
+ for t2 in [str, unicode]:
+ e = raises(WindowsError, startfile, t1("\\"), t2("close"))
+ assert e.value.args[0] == 1155
+ assert e.value.args[1] == (
+ "No application is associated with the "
+ "specified file for this operation")
+ if len(e.value.args) > 2:
+ assert e.value.args[2] == t1("\\")
+ #
+ e = raises(WindowsError, startfile, "\\foo\\bar\\baz")
+ assert e.value.args[0] == 2
+ assert e.value.args[1] == (
+ "The system cannot find the file specified")
+ if len(e.value.args) > 2:
+ assert e.value.args[2] == "\\foo\\bar\\baz"
+
class AppTestEnvironment(object):
def setup_class(cls):
More information about the pypy-commit
mailing list