[CalendarServer-changes] [15281] CalendarServer/branches/users/cdaboo/update-packages/calendarserver
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 4 06:53:15 PST 2015
Revision: 15281
http://trac.calendarserver.org//changeset/15281
Author: cdaboo at apple.com
Date: 2015-11-04 06:53:14 -0800 (Wed, 04 Nov 2015)
Log Message:
-----------
psutil API change.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/update-packages/calendarserver/accesslog.py
Added Paths:
-----------
CalendarServer/branches/users/cdaboo/update-packages/calendarserver/test/test_accesslog.py
Modified: CalendarServer/branches/users/cdaboo/update-packages/calendarserver/accesslog.py
===================================================================
--- CalendarServer/branches/users/cdaboo/update-packages/calendarserver/accesslog.py 2015-11-04 14:37:30 UTC (rev 15280)
+++ CalendarServer/branches/users/cdaboo/update-packages/calendarserver/accesslog.py 2015-11-04 14:53:14 UTC (rev 15281)
@@ -588,7 +588,7 @@
def __init__(self):
self.items = {
- "cpu count" : psutil.NUM_CPUS if psutil is not None else -1,
+ "cpu count" : psutil.cpu_count() if psutil is not None else -1,
"cpu use" : 0.0,
"memory used" : 0,
"memory percent": 0.0,
Added: CalendarServer/branches/users/cdaboo/update-packages/calendarserver/test/test_accesslog.py
===================================================================
--- CalendarServer/branches/users/cdaboo/update-packages/calendarserver/test/test_accesslog.py (rev 0)
+++ CalendarServer/branches/users/cdaboo/update-packages/calendarserver/test/test_accesslog.py 2015-11-04 14:53:14 UTC (rev 15281)
@@ -0,0 +1,38 @@
+##
+# Copyright (c) 2015 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+from twisted.trial.unittest import TestCase
+from calendarserver.accesslog import SystemMonitor
+
+class AccessLog(TestCase):
+ """
+ Tests for L{calendarserver.accesslog}.
+ """
+
+ def test_systemMonitor(self):
+ """
+ L{SystemMonitor} generates the correct data.
+ """
+
+ monitor = SystemMonitor()
+ self.assertNotEqual(monitor.items["cpu count"], 0)
+ self.assertEqual(monitor.items["cpu use"], 0.0)
+
+ monitor.update()
+ self.assertNotEqual(monitor.items["cpu count"], 0)
+
+ monitor.stop()
+ self.assertNotEqual(monitor.items["cpu count"], 0)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151104/47b960d6/attachment.html>
More information about the calendarserver-changes
mailing list