Piotr Kliczewski has uploaded a new change for review.

Change subject: tests: inspect.getargspec() is deprecated in py3
......................................................................

tests: inspect.getargspec() is deprecated in py3

We do not want to see following warning during running tests:
DeprecationWarning: inspect.getargspec() is deprecated


Change-Id: I25a58ea32bf7548a8f27cc217392fd0958cc8b7d
Signed-off-by: Piotr Kliczewski <piotr.kliczew...@gmail.com>
---
M tests/api_test.py
M tests/schemaValidationTest.py
M tests/testlib.py
3 files changed, 12 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/64313/1

diff --git a/tests/api_test.py b/tests/api_test.py
index 3c57381..b977415 100644
--- a/tests/api_test.py
+++ b/tests/api_test.py
@@ -18,12 +18,11 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
-import inspect
-
 from vdsm.common import api
 from vdsm.common import exception
 from vdsm.common import response
 
+from testlib import getargspec
 from testlib import VdsmTestCase as TestCaseBase
 
 
@@ -31,10 +30,10 @@
 
     def test_preserve_signature(self):
         vm = FakeVM()
-        args = inspect.getargspec(vm.fail)
+        args = getargspec(vm.fail)
         self.assertEqual(args.args, ['self', 'exc'])
         self.assertEqual(args.varargs, None)
-        self.assertEqual(args.keywords, None)
+        self.assertEqual(getattr(args, 'keywords', None), None)
 
 
 class TestResponse(TestCaseBase):
diff --git a/tests/schemaValidationTest.py b/tests/schemaValidationTest.py
index fd87724..13df62f 100644
--- a/tests/schemaValidationTest.py
+++ b/tests/schemaValidationTest.py
@@ -29,6 +29,7 @@
 
 from vdsm.rpc import Bridge
 from api import vdsmapi
+from testlib import getargspec
 from testlib import VdsmTestCase as TestCaseBase
 
 from contextlib import contextmanager
@@ -169,12 +170,12 @@
                 yield class_name, class_obj
 
     def _get_args(self, method_obj):
-        args = inspect.getargspec(method_obj).args
+        args = getargspec(method_obj).args
         args.remove('self')
         return args
 
     def _get_default_args(self, method_obj):
-        argSpec = inspect.getargspec(method_obj)
+        argSpec = getargspec(method_obj)
         if argSpec.defaults:
             return argSpec.args[- len(argSpec.defaults):]
         else:
diff --git a/tests/testlib.py b/tests/testlib.py
index c341c24..7c63a38 100644
--- a/tests/testlib.py
+++ b/tests/testlib.py
@@ -45,6 +45,12 @@
     import mock
 mock
 
+try:
+    from inspect import getfullargspec as getargspec
+except ImportError:  # py2
+    from inspect import getargspec as getargspec
+getargspec
+
 from nose import config
 from nose import core
 from nose import result


-- 
To view, visit https://gerrit.ovirt.org/64313
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25a58ea32bf7548a8f27cc217392fd0958cc8b7d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczew...@gmail.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to