def test_proc_info(self):
"""Proc info test."""
proc_info = sysinfo.proc_info(os.getpid())
# Handle running python with options, as in:
# sys.argv[0] == 'python -m unittest'
expected = os.path.basename(sys.argv[0].split()[0])
# TODO: When running coverage, script is execed under python.
# but sys.argv[0] reports as setup.py
#
# train starts subprocess for the test with altnose.py
# this makes this assert unusable
expected_progs = ['setup.py', 'altnose.py', 'sysinfo_test.py']
if expected not in expected_progs:
self.assertEqual(expected, proc_info.filename)
self.assertEqual(os.getppid(), proc_info.ppid)
# We do not check the starttime, but just verify that calling
# proc_info twice returns same starttime, which can be used as part of
# process signature.
self.assertEqual(
proc_info.starttime,
sysinfo.proc_info(os.getpid()).starttime
)
评论列表
文章目录