summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-02-03 16:51:21 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2016-02-03 16:51:21 +0100
commitecf0fdc39382620b42168aff6cc5fcd88988bf5b (patch)
treea1982e3c77d04b69ceac05a6c3f5a34f45ebb3fd
parent2985675b43aebd5f34c7f181dc88943c4af1c65a (diff)
downloadpsutil-ecf0fdc39382620b42168aff6cc5fcd88988bf5b.tar.gz
speed up linux test
-rw-r--r--test/_linux.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/_linux.py b/test/_linux.py
index 3723fe16..d36afc53 100644
--- a/test/_linux.py
+++ b/test/_linux.py
@@ -20,6 +20,7 @@ import socket
import struct
import sys
import tempfile
+import textwrap
import time
import warnings
@@ -35,12 +36,14 @@ from psutil._compat import PY3
from psutil._compat import u
from test_psutil import call_until
from test_psutil import get_kernel_version
-from test_psutil import get_test_subprocess
from test_psutil import importlib
from test_psutil import MEMORY_TOLERANCE
+from test_psutil import pyrun
+from test_psutil import reap_children
from test_psutil import retry_before_failing
from test_psutil import sh
from test_psutil import skip_on_not_implemented
+from test_psutil import TESTFN
from test_psutil import TRAVIS
from test_psutil import unittest
from test_psutil import which
@@ -116,9 +119,16 @@ class LinuxSpecificTestCase(unittest.TestCase):
self.fail("psutil=%s, df=%s" % (usage.used, used))
def test_memory_maps(self):
- sproc = get_test_subprocess()
- time.sleep(1)
+ src = textwrap.dedent("""
+ import time
+ with open("%s", "w") as f:
+ time.sleep(10)
+ """ % TESTFN)
+ sproc = pyrun(src)
+ self.addCleanup(reap_children)
+ call_until(lambda: os.listdir('.'), "'%s' not in ret" % TESTFN)
p = psutil.Process(sproc.pid)
+ time.sleep(.1)
maps = p.memory_maps(grouped=False)
pmap = sh('pmap -x %s' % p.pid).split('\n')
# get rid of header