Changed lowercase consts to UPPERCASE in call_box
BUG=NONE
TEST=run_all_tests.py
Change-Id: Iaa681d71803bc5881a17b08493ec7b6e67d8fd5d
Reviewed-on: https://gerrit.chromium.org/gerrit/63807
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Byron Kubert <byronk@chromium.org>
Commit-Queue: Byron Kubert <byronk@chromium.org>
diff --git a/aspects/configurable.py b/aspects/configurable.py
index ddb8db5..4e61614 100644
--- a/aspects/configurable.py
+++ b/aspects/configurable.py
@@ -270,6 +270,7 @@
"""
# The config spec(a ConfigObject term for the definition of the
# configuration)
+ CONFIGSPEC = ['Override configspec derived classes']
def __init__(self, input_config_data=None):
"""
diff --git a/instruments/call_box/agilent_pxt/call_box_fake.py b/instruments/call_box/agilent_pxt/call_box_fake.py
index 6dc776f..3feeaeb 100644
--- a/instruments/call_box/agilent_pxt/call_box_fake.py
+++ b/instruments/call_box/agilent_pxt/call_box_fake.py
@@ -3,10 +3,11 @@
# found in the LICENSE file.
import functools
+from instruments.call_box import call_box_interface
from wireless_automation.aspects import wireless_automation_error
from wireless_automation.aspects import wireless_automation_logging
from wireless_automation.instruments.call_box.agilent_pxt \
- import call_box_interface, call_box_pxt
+ import call_box_pxt
log = wireless_automation_logging.setup_logging('call_box_fake')
@@ -30,10 +31,10 @@
class CallBoxFakeBase(call_box_interface.CallBoxInterface):
# These are empty because this is a base class.
- _all_states = [] # List of possible states
- _idle_states = [] # The state that means it's idle
- _connected_states = [] # The states that count as connected
- _idn_string = "*idn? return" # The ID string *IDN? returns
+ ALL_STATES = [] # List of possible states
+ IDLE_STATES = [] # The state that means it's idle
+ CONNECTED_STATES = [] # The states that count as connected
+ IDN_STRING = "*idn? return" # The ID string *IDN? returns
@log_args_and_return_values
def __init__(self, config):
@@ -43,17 +44,17 @@
self.reset()
def get_id(self):
- return self._idn_string
+ return self.IDN_STRING
@log_args_and_return_values
def reset(self):
- self._current_state = self._all_states[0]
+ self._current_state = self.ALL_STATES[0]
self._power = -99 # Current power, dBm
self._rf_on = False
@log_args_and_return_values
def is_idle(self):
- return self._current_state in self._idle_states
+ return self._current_state in self.IDLE_STATES
@log_args_and_return_values
def close(self):
@@ -62,7 +63,7 @@
@log_args_and_return_values
def is_connected(self):
log.debug('in state: %s ' % self._current_state)
- return self._current_state in self._connected_states
+ return self._current_state in self.CONNECTED_STATES
@log_args_and_return_values
def _get_cell_status(self):
@@ -93,23 +94,23 @@
@log_args_and_return_values
def start(self):
- self._current_state = self._connected_states[0]
+ self._current_state = self.CONNECTED_STATES[0]
@log_args_and_return_values
def stop(self):
- self._current_state = self._idle_states[0]
+ self._current_state = self.IDLE_STATES[0]
class CallBoxPxt(CallBoxFakeBase):
"""
Map the real PXT values, so we test those.
"""
- _configspec = call_box_pxt.CallBoxPxt.configspec
- _all_states = call_box_pxt.CallBoxPxt.all_states
- _connected_states = call_box_pxt.CallBoxPxt.connected_states
- _idle_states = call_box_pxt.CallBoxPxt.idle_states
- _idn_string = call_box_pxt.CallBoxPxt.idn_string
- _match_in_id_string = call_box_pxt.CallBoxPxt.match_in_id_string
+ CONFIGSPEC = call_box_pxt.CallBoxPxt.CONFIGSPEC
+ ALL_STATES = call_box_pxt.CallBoxPxt.ALL_STATES
+ CONNECTED_STATES = call_box_pxt.CallBoxPxt.CONNECTED_STATES
+ IDLE_STATES = call_box_pxt.CallBoxPxt.IDLE_STATES
+ IDN_STRING = call_box_pxt.CallBoxPxt.IDN_STRING
+ MATCH_IN_ID_STRING = call_box_pxt.CallBoxPxt.MATCH_IN_ID_STRING
def __init__(self, config):
super(CallBoxPxt, self).__init__(config)
diff --git a/instruments/call_box/agilent_pxt/call_box_pxt.py b/instruments/call_box/agilent_pxt/call_box_pxt.py
index 2fdf095..dcf8e5e 100644
--- a/instruments/call_box/agilent_pxt/call_box_pxt.py
+++ b/instruments/call_box/agilent_pxt/call_box_pxt.py
@@ -4,10 +4,9 @@
import time
+from wireless_automation.instruments.call_box import call_box_interface
from wireless_automation.aspects import wireless_automation_error
from wireless_automation.instruments.prologix import prologix_scpi_driver
-from wireless_automation.instruments.call_box.agilent_pxt \
- import call_box_interface
from wireless_automation.labs import labconfig_data
@@ -15,7 +14,7 @@
"""
Object for the Agilent PXT, the LTE call box.
"""
- configspec = [
+ CONFIGSPEC = [
'channel=integer(min=0, max=9999, default=1)',
'scpi_hostname=string(default=lookup_in_labconfig)',
'port=integer(default=1234)',
@@ -26,15 +25,14 @@
# List of possible call status. Used in the CallBoxFakePxt
# to give correct answers, but stored here to keep all the
# PXT knowledge in one place.
- all_states = ['STOP', 'OFF', 'IDLE', 'CON', 'REG', 'LOOP', 'REL', 'UNAV']
- idle_states = ['STOP', 'IDLE', 'OFF']
- connected_states = ['CON']
- idn_string = "Agilent Technologies,E6621A,MY51100107,6.4.0.7"
- match_in_id_string = 'E6621'
+ ALL_STATES = ['STOP', 'OFF', 'IDLE', 'CON', 'REG', 'LOOP', 'REL', 'UNAV']
+ IDLE_STATES = ['STOP', 'IDLE', 'OFF']
+ CONNECTED_STATES = ['CON']
+ IDN_STRING = "Agilent Technologies,E6621A,MY51100107,6.4.0.7"
+ MATCH_IN_ID_STRING = 'E6621'
def __init__(self, config):
super(CallBoxPxt, self).__init__(config)
- self.is_this_config_valid(config)
if config['scpi_hostname'] == 'lookup_in_labconfig':
config['scpi_hostname'] = labconfig_data.oyster_bay_pxt_gpib_ip
@@ -46,7 +44,7 @@
connect_timeout_seconds=config['connect_timeout_seconds']
)
# Make sure we can talk to it, and it's the right box
- assert self.match_in_id_string in self.get_id()
+ assert self.MATCH_IN_ID_STRING in self.get_id()
def get_id(self):
return self.scpi.query("*IDN?")
@@ -56,13 +54,13 @@
def is_idle(self):
state = self.scpi.query('BSE:SIMULator?')
- return state in self.idle_states
+ return state in self.IDLE_STATES
def close(self):
self.scpi.close()
def is_connected(self):
- return self._get_cell_status() in self.connected_states
+ return self._get_cell_status() in self.CONNECTED_STATES
def _get_cell_status(self):
status = self.scpi.query('BSE:STATus:ACELL?')
@@ -99,4 +97,4 @@
time.sleep(1)
raise wireless_automation_error.InstrumentTimeout(
'PXT::Stop did not produce an idle state '
- 'Idle State: %s' % self.idle_states)
+ 'Idle State: %s' % self.IDLE_STATES)
diff --git a/instruments/call_box/agilent_pxt/call_box_pxt_test_with_hardware.py b/instruments/call_box/agilent_pxt/call_box_pxt_test_with_hardware.py
index 85160b9..b6d5370 100644
--- a/instruments/call_box/agilent_pxt/call_box_pxt_test_with_hardware.py
+++ b/instruments/call_box/agilent_pxt/call_box_pxt_test_with_hardware.py
@@ -39,7 +39,7 @@
assert not self.pxt.is_idle()
self.pxt.stop()
assert self.pxt.is_idle()
- assert self.pxt.match_in_id_string in self.pxt.get_id()
+ assert self.pxt.MATCH_IN_ID_STRING in self.pxt.get_id()
self.pxt.close()
assert power == power_read
diff --git a/instruments/call_box/agilent_pxt/call_box_interface.py b/instruments/call_box/call_box_interface.py
similarity index 100%
rename from instruments/call_box/agilent_pxt/call_box_interface.py
rename to instruments/call_box/call_box_interface.py