summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-04-24 16:19:15 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2020-04-24 16:19:15 +0200
commit942b67b88f6356e8b9d0240c46c1645ece2045df (patch)
tree2cd07d963205417bcd6ba9537448509a53cd283a
parent7f95d2c6a07be094b3a26105aa8f7526738b5e6d (diff)
downloadpsutil-942b67b88f6356e8b9d0240c46c1645ece2045df.tar.gz
fix errs
-rwxr-xr-xpsutil/tests/test_linux.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
index 2c5433f4..d529ae7c 100755
--- a/psutil/tests/test_linux.py
+++ b/psutil/tests/test_linux.py
@@ -28,7 +28,6 @@ from psutil._compat import FileNotFoundError
from psutil._compat import PY3
from psutil._compat import u
from psutil.tests import call_until
-from psutil.tests import get_tempfn
from psutil.tests import get_testfn
from psutil.tests import HAS_BATTERY
from psutil.tests import HAS_CPU_FREQ
@@ -1218,7 +1217,8 @@ class TestMisc(unittest.TestCase):
self.assertEqual(int(vmstat_value), int(psutil_value))
def test_no_procfs_on_import(self):
- my_procfs = get_tempfn()
+ my_procfs = get_testfn()
+ os.mkdir(my_procfs)
with open(os.path.join(my_procfs, 'stat'), 'w') as f:
f.write('cpu 0 0 0 0 0 0 0 0 0 0\n')
@@ -1346,7 +1346,8 @@ class TestMisc(unittest.TestCase):
assert m.called
def test_procfs_path(self):
- tdir = get_tempfn()
+ tdir = get_testfn()
+ os.mkdir(tdir)
try:
psutil.PROCFS_PATH = tdir
self.assertRaises(IOError, psutil.virtual_memory)
@@ -1362,7 +1363,6 @@ class TestMisc(unittest.TestCase):
self.assertRaises(psutil.NoSuchProcess, psutil.Process)
finally:
psutil.PROCFS_PATH = "/proc"
- os.rmdir(tdir)
def test_issue_687(self):
# In case of thread ID:
@@ -1742,7 +1742,7 @@ class TestProcess(unittest.TestCase):
# execution
p = psutil.Process()
files = p.open_files()
- with open(get_tempfn(), 'w'):
+ with open(get_testfn(), 'w'):
# give the kernel some time to see the new file
call_until(p.open_files, "len(ret) != %i" % len(files))
with mock.patch('psutil._pslinux.os.readlink',
@@ -1763,7 +1763,7 @@ class TestProcess(unittest.TestCase):
# https://travis-ci.org/giampaolo/psutil/jobs/225694530
p = psutil.Process()
files = p.open_files()
- with open(get_tempfn(), 'w'):
+ with open(get_testfn(), 'w'):
# give the kernel some time to see the new file
call_until(p.open_files, "len(ret) != %i" % len(files))
patch_point = 'builtins.open' if PY3 else '__builtin__.open'