Skip to content

Commit

Permalink
Merge branch 'master' into nicstats-250
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Feb 12, 2015
2 parents 86ffc46 + 70d6ee5 commit 9ae9b8c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ test-system: install
$(PYTHON) -m unittest -v test.test_psutil.TestSystemAPIs

test-memleaks: install
$(PYTHON) -m unittest -v test.test_memory_leaks
$(PYTHON) test/test_memory_leaks.py

# Run a specific test by name; e.g. "make test-by-name disk_" will run
# all test methods containing "disk_" in their name.
# Requires "pip install nose".
test-by-name: install
@$(PYTHON) -m nose test/test_psutil.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))

# same as above but for test_memory_leaks.py script
test-memleaks-by-name: install
@$(PYTHON) -m nose test/test_memory_leaks.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))

# requires "pip install pep8"
pep8:
@git ls-files | grep \\.py$ | xargs pep8
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ Process class
>>> p.io_counters()
pio(read_count=454556, write_count=3456, read_bytes=110592, write_bytes=0)

Availability: all platforms except OSX
Availability: all platforms except OSX and Solaris

.. method:: num_ctx_switches()

Expand Down
8 changes: 3 additions & 5 deletions psutil/_psutil_sunos.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,6 @@ psutil_per_cpu_times(PyObject *self, PyObject *args)
kstat_ctl_t *kc;
kstat_t *ksp;
cpu_stat_t cs;
int numcpus;
int i;
PyObject *py_retlist = PyList_New(0);
PyObject *py_cputime = NULL;

Expand Down Expand Up @@ -808,7 +806,7 @@ static PyObject *
psutil_net_connections(PyObject *self, PyObject *args)
{
long pid;
int sd = NULL;
int sd = 0;
mib2_tcpConnEntry_t *tp = NULL;
mib2_udpEntry_t *ude;
#if defined(AF_INET6)
Expand Down Expand Up @@ -1086,7 +1084,7 @@ psutil_net_connections(PyObject *self, PyObject *args)
Py_XDECREF(py_raddr);
Py_DECREF(py_retlist);
// TODO : free databuf
if (sd != NULL)
if (sd != 0)
close(sd);
return NULL;
}
Expand Down Expand Up @@ -1135,7 +1133,7 @@ psutil_cpu_count_phys(PyObject *self, PyObject *args)
for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
if (strcmp(ksp->ks_module, "cpu_info") != 0)
continue;
if (kstat_read(kc, ksp, NULL) == NULL)
if (kstat_read(kc, ksp, NULL) == -1)
goto error;
ncpus += 1;
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_memory_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def test_ionice_set(self):
self.execute('ionice', psutil.IOPRIO_CLASS_NONE)
self.execute_w_exc(OSError, 'ionice', -1)

@unittest.skipIf(OSX, "feature not supported on this platform")
@unittest.skipIf(OSX or SUNOS, "feature not supported on this platform")
@skip_if_linux()
def test_io_counters(self):
self.execute('io_counters')
Expand Down

0 comments on commit 9ae9b8c

Please sign in to comment.