anfedorov / psutil

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

test/test_psutil.py status, psutil-0.7.1 #379

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run test/test_psutil.py
2.
3.

What is the expected output?

What do you see instead?

What version of psutil are you using? What Python version?
-0.7.1; Python 2.7.3, pypy-2.0b2

On what operating system? Is it 32bit or 64bit version?
gentoo linux amd64

Please provide any additional information below.

pypy2_0: running

yields

Ran 106 tests in 16.831s

FAILED (failures=6, errors=5)

python2_7: running

yields

Ran 106 tests in 11.553s

FAILED (failures=6, errors=3)

I think some of these are expected fails, is so can you unittest deocate them 
as expected Failures??

So many failures the test run has been restricted

Original issue reported on code.google.com by IDela...@irelandxo.com on 12 May 2013 at 4:29

Attachments:

GoogleCodeExporter commented 9 years ago
I tried to address all the failures reported in the log as of:
revision 24f293c9751e
revision 70d013af2da2
revision 73e65535bbf5
revision b297c7baf424 (most important)
Can you try to re-run tests with latest HG revision and report back?

Original comment by g.rodola on 12 May 2013 at 11:28

GoogleCodeExporter commented 9 years ago
tests/_posix.py needs to import test_psutil.retry_before_failing.

diff --git a/test/_posix.py b/test/_posix.py
--- a/test/_posix.py
+++ b/test/_posix.py
@@ -17,7 +17,7 @@

 from psutil._compat import PY3
 from test_psutil import (get_test_subprocess, reap_children, PYTHON, LINUX, OSX,
-                         BSD, skip_on_access_denied, sh, skipIf)
+                         BSD, skip_on_access_denied, sh, skipIf, 
retry_before_failing)

 def ps(cmd):

Original comment by floppymaster@gmail.com on 13 May 2013 at 12:23

GoogleCodeExporter commented 9 years ago
After making that change, I get this error with linux-3.8.4 and 3.9.2.

======================================================================
ERROR: test_as_dict (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 1570, in test_as_dict
    d = p.as_dict()
  File "/home/floppym/src/psutil/build/lib.linux-x86_64-2.7/psutil/__init__.py", line 211, in as_dict
    ret = attr()
  File "/home/floppym/src/psutil/build/lib.linux-x86_64-2.7/psutil/__init__.py", line 657, in get_memory_maps
    for tupl in it:
  File "/home/floppym/src/psutil/build/lib.linux-x86_64-2.7/psutil/_pslinux.py", line 637, in get_memory_maps
    for header, data in get_blocks():
  File "/home/floppym/src/psutil/build/lib.linux-x86_64-2.7/psutil/_pslinux.py", line 633, in get_blocks
    data[fields[0]] = int(fields[1]) * 1024
ValueError: invalid literal for int() with base 10: 'mr'

% grep mr /proc/self/smaps
VmFlags: rd ex mr mw me dw
VmFlags: rd mr mw me dw ac
...

Original comment by floppymaster@gmail.com on 13 May 2013 at 12:27

GoogleCodeExporter commented 9 years ago
This is looking better.
cloned the hg repo, added the import found by the floppy one in #2, 
+ 1 minor change;   the ps name made was gvfs-gdu-volume-monitor, however the 
actual file in /usr/libexec is gvfs-udisks2-volume-monitor, I suspect a name 
change in the most recent version gnome-base/gvfs and it's picking up an old 
name, otherwise add that to the list of required fixes.  I made a symlink for 
it in /usr/libexec and it found it and passed.

py2.7
/psutil $ sudo PYTHONPATH=./build/lib.linux-x86_64-2.7/ python 
test/test_psutil.py 

----------------------------------------------------------------------
Ran 187 tests in 5.525s

OK
test/test_psutil.py:83: RuntimeWarning: 
'TestFetchAllProcesses.test_get_io_counters' was skipped because not implemented
  warnings.warn(msg, warntype)
test/test_psutil.py:83: RuntimeWarning: 'test_get_io_counters' was skipped 
because it raised NotImplementedError
  warnings.warn(msg, warntype)

pypy
/psutil $ sudo PYTHONPATH=./build/lib.linux-x86_64-2.7/ pypy-c2.0 
test/test_psutil.py 

======================================================================
ERROR: test_disks (_linux.LinuxSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/testuser/bitBuckett/psutil/test/test_psutil.py", line 254, in wrapper
    return fun(*args, **kwargs)
  File "/home/testuser/bitBuckett/psutil/test/_linux.py", line 52, in test_disks
    usage = psutil.disk_usage(part.mountpoint)
  File "/home/testuser/bitBuckett/psutil/build/lib.linux-x86_64-2.7/psutil/__init__.py", line 1180, in disk_usage
    return _psplatform.get_disk_usage(path)
  File "/home/testuser/bitBuckett/psutil/build/lib.linux-x86_64-2.7/psutil/_psposix.py", line 99, in get_disk_usage
    st = os.statvfs(path)
AttributeError: 'module' object has no attribute 'statvfs'

----------------------------------------------------------------------
Ran 187 tests in 8.250s

FAILED (errors=1)

py3.2
psutil $ sudo PYTHONPATH=./build/lib.linux-x86_64-3.2/ python3.2 
test/test_psutil.py 

----------------------------------------------------------------------
Ran 187 tests in 6.793s

OK
test/test_psutil.py:83: RuntimeWarning: 
'TestFetchAllProcesses.test_get_io_counters' was skipped because not implemented
  warnings.warn(msg, warntype)
test/test_psutil.py:83: RuntimeWarning: 'test_get_io_counters' was skipped 
because it raised NotImplementedError
  warnings.warn(msg, warntype)

I could do more python versions but that should do the trick.

Original comment by IDela...@irelandxo.com on 13 May 2013 at 2:15

GoogleCodeExporter commented 9 years ago
Remaining failures fixed as of revision 2ecd58e2f0ea.
As for this one:

get_memory_maps
ValueError: invalid literal for int() with base 10: 'mr'

...it is tracked in issue 369 and I will fix that separately.
Closing this out for now and thanks for signaling.

Original comment by g.rodola on 13 May 2013 at 10:56

GoogleCodeExporter commented 9 years ago
I did more.
results vary from run to run under pypy which I'd guess isn't a priority.
The above;

Python 2.7.3 (4b60269153b5b10c69155b6270bcce7a31a86281, May 10 2013, 02:23:28)
[PyPy 2.0.0-beta2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``first they laugh at you, then
they ignore you, then they fight you, then you win''
>>>> import sys
>>>> import os
>>>> os.statvfs
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'statvfs'
>>>> 

would warrant a  skip if sys.version_info has attr pypy or such.  From an 
ebuild I also had to change @skipIf(POSIX and not hasattr(os, 'statvfs'), ->
@skipIf(POSIX or not hasattr(os, 'statvfs'),  for def test_disk_usage

Python3 all trip over test_deprecated_apis_retval

=====================================================================
FAIL: test_deprecated_apis_retval (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 418, in test_deprecated_apis_retval
    self.assertEqual(psutil.get_process_list(), list(psutil.process_iter()))
AssertionError: Lists differ: [<psutil.Process(pid=1, name='... != 
[<psutil.Process(pid=1, name='...

First differing element 171:
psutil.Process(pid=30957 (terminated))
psutil.Process(pid=31472, name='python3.1')

First list contains 2 additional elements.
First extra element 179:
psutil.Process(pid=32232, name='emerge')

Diff is 12334 characters long. Set self.maxDiff to None to see it.

----------------------------------------------------------------------
Ran 106 tests in 4.910s

FAILED (failures=1)
test/test_psutil.py:83: RuntimeWarning: 
'TestFetchAllProcesses.test_get_io_counters' was skipped because not implemented
  warnings.warn(msg, warntype)
test/test_psutil.py:83: RuntimeWarning: 'test_get_io_counters' was skipped 
because it raised NotImplementedError
  warnings.warn(msg, warntype)
test/test_psutil.py:83: RuntimeWarning: Couldn't run limited user tests 
(super-user privileges are required)
  warnings.warn(msg, warntype)

Original comment by IDela...@irelandxo.com on 13 May 2013 at 11:13

GoogleCodeExporter commented 9 years ago
right, seeing you entered "Remaining failures fixed as of.. " 17 minutes prior 
to my last entry, I finish off with this one final note.  

Recant on having to change @skipIf(POSIX and not hasattr(os, 'statvfs'), ->
@skipIf(POSIX or not hasattr(os, 'statvfs'),  for def test_disk_usage for pypy. 
 Instead pypy also trips over test_deprecated_apis_retval, making most of these 
bugs fixed but for these last few that bit too late.

Original comment by IDela...@irelandxo.com on 13 May 2013 at 5:53

GoogleCodeExporter commented 9 years ago
Issue 381 has been merged into this issue.

Original comment by g.rodola on 13 May 2013 at 7:57

GoogleCodeExporter commented 9 years ago

Original comment by g.rodola on 8 Jun 2013 at 12:23

GoogleCodeExporter commented 9 years ago

Original comment by g.rodola on 11 Jul 2013 at 8:54