Closed GoogleCodeExporter closed 8 years ago
Attached is a patch that fixes test_phymem_usage and test_sys_per_cpu_times2.
I will look into test_get_connections_all next.
Note: Even after all this work is done there will be two failing tests on OS X:
test_disk_partitions and test_disk_usage. The work for these is actually being
tracked in Issue 174 and Issue 172 respectively.
Original comment by jcscoob...@gmail.com
on 22 Jun 2011 at 11:53
Attachments:
I have test_get_connections_all passing on OS X. It seems that when you use 0
or '' for the host or port for socket.bind(tuple) Python resorts to the OS to
dictate how it connects. While your test checks for "::1" for the local IP
(127.0.0.1 in IPv4), on OS X 10.6.7 it's listening on "::" (0.0.0.0 in IPv4).
The simple change would be to check that the local address is in ["::", "::1"]
for the TCP and UDP tests for IPv6 support. That being said, I have this fixed
locally but since I have two patches in limbo already, I'll hold off on
submitting any other diff to avoid change collision.
Original comment by jcscoob...@gmail.com
on 23 Jun 2011 at 4:17
Hi and thanks for the interest.
In r1043 I tried to fix test_phymem_usage and test_sys_per_cpu_times2.
I haven't checked though, since I got no OSX to test against at the moment.
Feel free to provide a patch for test_connections.
Original comment by g.rodola
on 27 Jun 2011 at 8:16
I'm trying to rerun the tests and I think the fix disk usage committed is
causing an issue.
python test/test_psutil.py
Traceback (most recent call last):
File "test/test_psutil.py", line 29, in <module>
import psutil
File "/Users/jwhitlock/development/python/psutil/build/lib.macosx-10.6-universal-2.6/psutil/__init__.py", line 85, in <module>
TOTAL_PHYMEM = _psplatform.phymem_usage()[0]
File "/Users/jwhitlock/development/python/psutil/build/lib.macosx-10.6-universal-2.6/psutil/_psosx.py", line 32, in phymem_usage
return ntuple_sysmeminfo(total, used, free, percent)
NameError: global name 'percent' is not defined
I'll commit a fix with my next patch.
Original comment by jcscoob...@gmail.com
on 27 Jun 2011 at 4:07
Attached is a patch that fixes the test_get_connections_all and the broken
phymem_usage for OS X. I notice that test_sys_per_cpu_times2 is still failing
because 0.1s is not enough time for CPU variance to differ by 0.5%. I can only
assume this is related to the system having multiple CPUs and maybe one of the
CPUs hasn't differed much. I attached a patch earlier that changed the sleep
timeout to allow for more variance but it wasn't committed. I went ahead an
changed the time.sleep in test_sys_per_cpu_times2 so that tests pass locally
other than the new API for partition information.
Original comment by jcscoob...@gmail.com
on 27 Jun 2011 at 4:14
Attachments:
I lied, I didn't change test_sys_per_cpu_times2 to have a longer sleep time but
you should get the idea. I have a new i7 with 4 real cores and 8 total
virtual. (I say 8 virtual because OS X reports 8 CPUs in Activity Monitor due
to the i7 supporting Hyper-Threading (http://support.apple.com/kb/HT4180). I
think that since this system has so many reported CPUs, maybe one/more of the
CPUs aren't changing much or at all in the 0.1 sleep.
Original comment by jcscoob...@gmail.com
on 27 Jun 2011 at 4:18
Ok I managed to install OSX on virtual box.
In r1045 I fixed the NameError exception and the connections-related test.
> I notice that test_sys_per_cpu_times2 is still failing because 0.1s
> is not enough time for CPU variance to differ by 0.5
What thereshold is working for you?
time.sleep(10) is way too much time to wait.
Does this change work for you?
- if not difference >= 0.05:
+ if not difference >= 0.01:
Original comment by g.rodola
on 27 Jun 2011 at 4:32
Okay, I looked into this more and 0.5 will fix test_sys_cpu_times2. Where the
problem lies is that in test_sys_per_cpu_times2, it's probably good but not all
cores are differing by 0.05% which is why the test fails. What if we bumped
the sleep to 0.5 and in test_sys_per_cpu_times2 we test that at least one CPU
varies by 0.05% instead of requiring all CPUs vary by that much?
Original comment by jcscoob...@gmail.com
on 27 Jun 2011 at 4:42
What about now (r1046)?
Original comment by g.rodola
on 27 Jun 2011 at 4:46
That seemed to do it.
Original comment by jcscoob...@gmail.com
on 27 Jun 2011 at 4:48
Cool. Closing out as fixed.
Original comment by g.rodola
on 27 Jun 2011 at 5:00
[deleted comment]
Updated csets after the SVN -> Mercurial migration:
r1041 == revision d2eb417fbb07
r1043 == revision 11ffad66d82d
r1045 == revision c27ef22ba263
r1046 == revision 1301c7d413ae
Original comment by g.rodola
on 2 Mar 2013 at 12:01
Original issue reported on code.google.com by
jcscoob...@gmail.com
on 22 Jun 2011 at 11:44