psutil.tests.test_contracts

Contracts tests. These tests mainly check API sanity in terms of returned types and APIs availability. Some of these are duplicates of tests test_system.py and test_process.py

Module Contents

class TestAvailability

Bases:psutil.tests.unittest.TestCase

Make sure code reflects what doc promises in terms of APIs availability.

test_cpu_affinity(self)
test_win_service(self)
test_PROCFS_PATH(self)
test_win_priority(self)
test_linux_ioprio(self)
test_linux_rlimit(self)
test_cpu_freq(self)
test_sensors_temperatures(self)
test_sensors_fans(self)
test_battery(self)
test_proc_environ(self)
test_proc_uids(self)
test_proc_gids(self)
test_proc_terminal(self)
test_proc_ionice(self)
test_proc_rlimit(self)
test_proc_io_counters(self)
test_proc_num_fds(self)
test_proc_num_handles(self)
test_proc_cpu_affinity(self)
test_proc_cpu_num(self)
test_proc_memory_maps(self)
class TestDeprecations

Bases:psutil.tests.unittest.TestCase

test_memory_info_ex(self)
class TestSystem

Bases:psutil.tests.unittest.TestCase

Check the return types of system related APIs. Mainly we want to test we never return unicode on Python 2, see: https://github.com/giampaolo/psutil/issues/1039

classmethod setUpClass(cls)
tearDown(self)
test_cpu_times(self)
test_io_counters(self)
test_disk_partitions(self)
test_net_connections(self)
test_net_if_addrs(self)
test_net_if_stats(self)
test_net_io_counters(self)
test_sensors_fans(self)
test_sensors_temperatures(self)
test_users(self)
class TestFetchAllProcesses

Bases:psutil.tests.unittest.TestCase

Test which iterates over all running processes and performs some sanity checks against Process API’s returned values.

test_fetch_all(self)
cmdline(self, ret, proc)
exe(self, ret, proc)
pid(self, ret, proc)
ppid(self, ret, proc)
name(self, ret, proc)
create_time(self, ret, proc)
uids(self, ret, proc)
gids(self, ret, proc)
username(self, ret, proc)
status(self, ret, proc)
io_counters(self, ret, proc)
ionice(self, ret, proc)
num_threads(self, ret, proc)
threads(self, ret, proc)
cpu_times(self, ret, proc)
cpu_percent(self, ret, proc)
cpu_num(self, ret, proc)
memory_info(self, ret, proc)
memory_full_info(self, ret, proc)
open_files(self, ret, proc)
num_fds(self, ret, proc)
connections(self, ret, proc)
cwd(self, ret, proc)
memory_percent(self, ret, proc)
is_running(self, ret, proc)
cpu_affinity(self, ret, proc)
terminal(self, ret, proc)
memory_maps(self, ret, proc)
num_handles(self, ret, proc)
nice(self, ret, proc)
num_ctx_switches(self, ret, proc)
rlimit(self, ret, proc)
environ(self, ret, proc)