Backed out changeset 697eb6db7d96 (bug 930808) for OS X make check failures
This commit is contained in:
@@ -6,17 +6,17 @@
|
||||
|
||||
"""OSX specific tests. These are implicitly run by test_psutil.py."""
|
||||
|
||||
import unittest
|
||||
import subprocess
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
import psutil
|
||||
|
||||
from psutil._compat import PY3
|
||||
from test_psutil import (TOLERANCE, sh, get_test_subprocess, reap_children,
|
||||
retry_before_failing, unittest)
|
||||
from test_psutil import *
|
||||
|
||||
|
||||
PAGESIZE = os.sysconf("SC_PAGE_SIZE")
|
||||
@@ -35,7 +35,6 @@ def sysctl(cmdline):
|
||||
except ValueError:
|
||||
return result
|
||||
|
||||
|
||||
def vm_stat(field):
|
||||
"""Wrapper around 'vm_stat' cmdline utility."""
|
||||
out = sh('vm_stat')
|
||||
@@ -49,22 +48,20 @@ def vm_stat(field):
|
||||
|
||||
class OSXSpecificTestCase(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.pid = get_test_subprocess().pid
|
||||
def setUp(self):
|
||||
self.pid = get_test_subprocess().pid
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def tearDown(self):
|
||||
reap_children()
|
||||
|
||||
def test_process_create_time(self):
|
||||
cmdline = "ps -o lstart -p %s" % self.pid
|
||||
cmdline = "ps -o lstart -p %s" %self.pid
|
||||
p = subprocess.Popen(cmdline, shell=1, stdout=subprocess.PIPE)
|
||||
output = p.communicate()[0]
|
||||
if PY3:
|
||||
output = str(output, sys.stdout.encoding)
|
||||
start_ps = output.replace('STARTED', '').strip()
|
||||
start_psutil = psutil.Process(self.pid).create_time()
|
||||
start_psutil = psutil.Process(self.pid).create_time
|
||||
start_psutil = time.strftime("%a %b %e %H:%M:%S %Y",
|
||||
time.localtime(start_psutil))
|
||||
self.assertEqual(start_ps, start_psutil)
|
||||
@@ -100,7 +97,7 @@ class OSXSpecificTestCase(unittest.TestCase):
|
||||
|
||||
def test_vmem_total(self):
|
||||
sysctl_hwphymem = sysctl('sysctl hw.memsize')
|
||||
self.assertEqual(sysctl_hwphymem, psutil.virtual_memory().total)
|
||||
self.assertEqual(sysctl_hwphymem, psutil.TOTAL_PHYMEM)
|
||||
|
||||
@retry_before_failing()
|
||||
def test_vmem_free(self):
|
||||
|
||||
Reference in New Issue
Block a user