diff mbox series

[05/50] tests: Use python3 compatible function attribute

Message ID 20190124074630.4192-6-masashi.honma@gmail.com
State Accepted
Headers show
Series Use python3 compatible codes for hwsim tests | expand

Commit Message

Masashi Honma Jan. 24, 2019, 7:45 a.m. UTC
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f funcattrs -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 tests/hwsim/run-tests.py      | 4 ++--
 tests/remote/hwsim_wrapper.py | 4 ++--
 tests/remote/run-tests.py     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 7e5edc7ff..be0edcb7a 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -488,12 +488,12 @@  def main():
                         set_term_echo(sys.stdin.fileno(), True)
                     sys.exit(1)
             try:
-                if t.func_code.co_argcount > 2:
+                if t.__code__.co_argcount > 2:
                     params = {}
                     params['logdir'] = args.logdir
                     params['long'] = args.long
                     t(dev, apdev, params)
-                elif t.func_code.co_argcount > 1:
+                elif t.__code__.co_argcount > 1:
                     t(dev, apdev)
                 else:
                     t(dev)
diff --git a/tests/remote/hwsim_wrapper.py b/tests/remote/hwsim_wrapper.py
index d2598abb5..c1bbb27d7 100644
--- a/tests/remote/hwsim_wrapper.py
+++ b/tests/remote/hwsim_wrapper.py
@@ -68,9 +68,9 @@  def run_hwsim_test(devices, setup_params, refs, duts, monitors, hwsim_test):
             apdev.append(dut_host.dev)
 
         # run hwsim test/currently only 2 params tests
-        if hwsim_test.func_code.co_argcount == 1:
+        if hwsim_test.__code__.co_argcount == 1:
             hwsim_test(dev)
-        elif hwsim_test.func_code.co_argcount == 2:
+        elif hwsim_test.__code__.co_argcount == 2:
             hwsim_test(dev, apdev)
         else:
             raise Exception("more than 2 arguments required")
diff --git a/tests/remote/run-tests.py b/tests/remote/run-tests.py
index 284205018..75497b4c9 100755
--- a/tests/remote/run-tests.py
+++ b/tests/remote/run-tests.py
@@ -200,7 +200,7 @@  def main():
                 t = None
                 for tt in hwsim_tests:
                     name = tt.__name__.replace('test_', '', 1)
-                    if name == test and tt.func_code.co_argcount <= 2:
+                    if name == test and tt.__code__.co_argcount <= 2:
                         t = tt
                         break
                 if not t: