end18 / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

init tests failing if no swap is available. #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

What steps will reproduce the problem?
What is the expected output? What do you see instead?

My system don't have any swap:

$ free -m
             total       used       free     shared    buffers     cached
Mem:          3966       3795        170          0         28        969
-/+ buffers/cache:       2797       1168
Swap:            0          0          0

and so also psutil shows 0:

In [1]: import psutil as p

In [2]: p.avail_virtmem
Out[2]: <function avail_virtmem at 0x1e38f50>

In [3]: p.avail_virtmem()
Out[3]: 0

In [4]: p.total_virtmem()
Out[4]: 0

But then tests are failing because the assert it to be > 0:

======================================================================
FAIL: test_avail_virtmem (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 102, in test_avail_virtmem
    self.assertTrue(x > 0)
AssertionError

======================================================================
FAIL: test_total_virtmem (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 92, in test_total_virtmem
    self.assertTrue(x > 0)
AssertionError

----------------------------------------------------------------------

My suggestion is to change it to >= 0 .

What version of psutil are you using? On what operating system?

psutil = 0.1.2 (you may also want to add a __version__ to the module)
os = Debian Sid

Thanks for considering,
Sandro

Original issue reported on code.google.com by matrixhasu on 4 Jul 2009 at 6:52

GoogleCodeExporter commented 9 years ago
Fixed as r413 (also added the __version__ module level variable).
Thanks for signaling.

Original comment by billiej...@gmail.com on 6 Jul 2009 at 3:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 6 Jul 2009 at 3:26

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 3 Sep 2009 at 7:48

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 17 Sep 2009 at 8:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated csets after the SVN -> Mercurial migration:
r413 == revision aada682d9e36

Original comment by g.rodola on 2 Mar 2013 at 11:49