summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrung Tran <trung.tran@ettus.com>2019-01-20 01:35:37 -0800
committerBrent Stapleton <brent.stapleton@ettus.com>2019-01-23 11:03:39 -0800
commitc6618dd8d3daf986f40d0877231d106a5789d984 (patch)
treede3c50bd239cfa5f017aa378112f34ee80456d25
parentlib: rfnoc: Add some missing virtual destructors (diff)
downloaduhd-c6618dd8d3daf986f40d0877231d106a5789d984.tar.xz
uhd-c6618dd8d3daf986f40d0877231d106a5789d984.zip
tests: replace has_key by using 'in'
python3+ dropped has_key function on dictionary. In order to make it compatible, we need to use 'in' keyword. Signed-off-by: Trung.Tran<trung.tran@ettus.com>
-rwxr-xr-xhost/tests/devtest/rx_samples_to_file_test.py2
-rw-r--r--host/tests/devtest/test_messages_test.py2
-rwxr-xr-xhost/tests/devtest/test_pps_test.py2
-rwxr-xr-xhost/tests/devtest/tx_bursts_test.py2
-rwxr-xr-xhost/tests/devtest/uhd_test_base.py8
5 files changed, 8 insertions, 8 deletions
diff --git a/host/tests/devtest/rx_samples_to_file_test.py b/host/tests/devtest/rx_samples_to_file_test.py
index b12eae9ad..4d95ff6ef 100755
--- a/host/tests/devtest/rx_samples_to_file_test.py
+++ b/host/tests/devtest/rx_samples_to_file_test.py
@@ -42,7 +42,7 @@ class rx_samples_to_file_test(uhd_example_test_case):
'--rate', str(test_args.get('rate', 1e6)),
'--wirefmt', test_args.get('wirefmt', 'sc16'),
]
- if test_args.has_key('subdev'):
+ if 'subdev' in test_args:
args.append('--subdev')
args.append(test_args['subdev'])
_, run_results = self.run_example('rx_samples_to_file', args)
diff --git a/host/tests/devtest/test_messages_test.py b/host/tests/devtest/test_messages_test.py
index 55d70db9c..eb39c29f7 100644
--- a/host/tests/devtest/test_messages_test.py
+++ b/host/tests/devtest/test_messages_test.py
@@ -29,7 +29,7 @@ class uhd_test_messages_test(uhd_example_test_case):
args = [
self.create_addr_args_str(),
]
- if test_args.has_key('ntests'):
+ if 'ntests' in test_args:
args.append('--ntests')
args.append(test_args['ntests'])
(app, run_results) = self.run_example('test_messages', args)
diff --git a/host/tests/devtest/test_pps_test.py b/host/tests/devtest/test_pps_test.py
index 39c47d1c7..bccb9bed9 100755
--- a/host/tests/devtest/test_pps_test.py
+++ b/host/tests/devtest/test_pps_test.py
@@ -27,7 +27,7 @@ class uhd_test_pps_test(uhd_example_test_case):
args = [
self.create_addr_args_str(),
]
- if test_args.has_key('source'):
+ if 'source' in test_args:
args.append('--source')
args.append(test_args['source'])
(app, run_results) = self.run_example('test_pps_input', args)
diff --git a/host/tests/devtest/tx_bursts_test.py b/host/tests/devtest/tx_bursts_test.py
index 48bc4d2cb..513c2a303 100755
--- a/host/tests/devtest/tx_bursts_test.py
+++ b/host/tests/devtest/tx_bursts_test.py
@@ -38,7 +38,7 @@ class uhd_tx_bursts_test(uhd_example_test_case):
'--channels', str(test_args['channels']),
'--rate', str(test_args.get('rate', 1e6)),
]
- if test_args.has_key('subdev'):
+ if 'subdev' in test_args:
args.append('--subdev')
args.append(test_args['subdev'])
(app, run_results) = self.run_example('tx_bursts', args)
diff --git a/host/tests/devtest/uhd_test_base.py b/host/tests/devtest/uhd_test_base.py
index 57193e625..d77226941 100755
--- a/host/tests/devtest/uhd_test_base.py
+++ b/host/tests/devtest/uhd_test_base.py
@@ -153,7 +153,7 @@ class uhd_test_case(unittest.TestCase):
""" Store a result as a key/value pair.
After completion, all results for one test are written to the results file.
"""
- if not self.results[self.usrp_info['serial']][self.name].has_key(testname):
+ if not testname in self.results[self.usrp_info['serial']][self.name]:
self.results[self.usrp_info['serial']][self.name][testname] = {}
self.results[self.usrp_info['serial']][self.name][testname][key] = value
@@ -214,13 +214,13 @@ class uhd_example_test_case(uhd_test_case):
test_name,
key, run_results[key]
)
- if run_results.has_key('passed'):
+ if 'passed' in run_results:
self.report_result(
test_name,
'status',
'Passed' if run_results['passed'] else 'Failed',
)
- if run_results.has_key('errors'):
+ if 'errors' in run_results:
self.report_result(
test_name,
'errors',
@@ -234,7 +234,7 @@ class uhd_example_test_case(uhd_test_case):
"""
for test_name, test_args in iteritems(self.test_params):
time.sleep(15) # Wait for X300 devices to reclaim them
- if not test_args.has_key('products') \
+ if not 'products' in test_args \
or (self.usrp_info['product'] in test_args.get('products', [])):
run_results = self.run_test(test_name, test_args)
passed = bool(run_results)