aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-10-07 08:34:21 +0300
committerMatti Picus <matti.picus@gmail.com>2020-10-07 08:34:21 +0300
commitf8f3d165e7f6c384877b8ba9dc09c4aa75853922 (patch)
tree54ac2a0c4df9cd03bab49dd09bf19f09c660d023 /extra_tests
parentfix failing tests (diff)
downloadpypy-f8f3d165e7f6c384877b8ba9dc09c4aa75853922.tar.gz
pypy-f8f3d165e7f6c384877b8ba9dc09c4aa75853922.tar.bz2
pypy-f8f3d165e7f6c384877b8ba9dc09c4aa75853922.zip
more test fixes
Diffstat (limited to 'extra_tests')
-rw-r--r--extra_tests/test_os.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/extra_tests/test_os.py b/extra_tests/test_os.py
index 8cc84ab6c1..a95efb1ab9 100644
--- a/extra_tests/test_os.py
+++ b/extra_tests/test_os.py
@@ -57,20 +57,24 @@ if hasattr(os, "execv"):
def test_execve():
if not hasattr(os, "fork"):
skip("Need fork() to test execve()")
+ if not os.path.isdir('/tmp'):
+ skip("Need '/tmp' for test")
pid = os.fork()
if pid == 0:
os.execve("/usr/bin/env", ["env", python, "-c",
- ("import os; fid = open('onefile', 'w'); "
+ ("import os; fid = open('/tmp/onefile2', 'w'); "
"fid.write(os.environ['ddd']); "
"fid.close()")],
{'ddd': 'xxx'})
os.waitpid(pid, 0)
- assert open("onefile").read() == "xxx"
- os.unlink("onefile")
+ assert open("/tmp/onefile2").read() == "xxx"
+ os.unlink("/tmp/onefile2")
def test_execve_unicode():
if not hasattr(os, "fork"):
skip("Need fork() to test execve()")
+ if not os.path.isdir('/tmp'):
+ skip("Need '/tmp' for test")
try:
output = u"caf\xe9 \u1234\n".encode(sys.getfilesystemencoding())
except UnicodeEncodeError:
@@ -78,12 +82,12 @@ if hasattr(os, "execv"):
pid = os.fork()
if pid == 0:
os.execve(u"/bin/sh", ["sh", "-c",
- u"echo caf\xe9 \u1234 > onefile"],
+ u"echo caf\xe9 \u1234 > /tmp/onefile3"],
{'ddd': 'xxx'})
os.waitpid(pid, 0)
- with open("onefile") as fid:
+ with open("/tmp/onefile3") as fid:
assert fid.read() == output
- os.unlink("onefile")
+ os.unlink("/tmp/onefile3")
pass # <- please, inspect.getsource(), don't crash
if hasattr(os, "spawnv"):