diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-10-06 08:48:26 +0300 |
---|---|---|
committer | Matti Picus <matti.picus@gmail.com> | 2020-10-06 08:48:26 +0300 |
commit | 2ccc817a49632b5807720ea438d46799a3e2d16a (patch) | |
tree | 160896afbcaf9bcad9169a2ba1fae3b78cd79dc5 /extra_tests | |
parent | Fix crypt with a multithread protection lock, similar to the one in grp.py (diff) | |
download | pypy-2ccc817a49632b5807720ea438d46799a3e2d16a.tar.gz pypy-2ccc817a49632b5807720ea438d46799a3e2d16a.tar.bz2 pypy-2ccc817a49632b5807720ea438d46799a3e2d16a.zip |
fix failing tests
Diffstat (limited to 'extra_tests')
-rw-r--r-- | extra_tests/test_os.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/extra_tests/test_os.py b/extra_tests/test_os.py index df692355de..8cc84ab6c1 100644 --- a/extra_tests/test_os.py +++ b/extra_tests/test_os.py @@ -8,15 +8,17 @@ if hasattr(os, "execv"): def test_execv(): if not hasattr(os, "fork"): skip("Need fork() to test execv()") + if not os.path.isdir('/tmp'): + skip("Need '/tmp' for test") pid = os.fork() if pid == 0: os.execv("/usr/bin/env", ["env", python, "-c", - ("fid = open('onefile', 'w'); " + ("fid = open('/tmp/onefile0', 'w'); " "fid.write('1'); " "fid.close()")]) os.waitpid(pid, 0) - assert open("onefile").read() == "1" - os.unlink("onefile") + assert open("/tmp/onefile0").read() == "1" + os.unlink("/tmp/onefile0") def test_execv_raising(): with raises(OSError): @@ -37,6 +39,8 @@ if hasattr(os, "execv"): def test_execv_unicode(): if not hasattr(os, "fork"): skip("Need fork() to test execv()") + if not os.path.isdir('/tmp'): + skip("Need '/tmp' for test") try: output = u"caf\xe9 \u1234\n".encode(sys.getfilesystemencoding()) except UnicodeEncodeError: @@ -44,11 +48,11 @@ if hasattr(os, "execv"): pid = os.fork() if pid == 0: os.execv(u"/bin/sh", ["sh", "-c", - u"echo caf\xe9 \u1234 > onefile"]) + u"echo caf\xe9 \u1234 > /tmp/onefile1"]) os.waitpid(pid, 0) - with open("onefile") as fid: + with open("/tmp/onefile1") as fid: assert fid.read() == output - os.unlink("onefile") + os.unlink("/tmp/onefile1") def test_execve(): if not hasattr(os, "fork"): |