Skip to content

Commit

Permalink
flake issues resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
andlem74 committed Jul 29, 2023
1 parent 23785fc commit 6dbdcd1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/modules/devices/json/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def __init__(self,

class JsonCounterConfiguration:
def __init__(self, jq_power: str = "", jq_exported: Optional[str] = None, jq_imported: Optional[str] = None,
jq_power_l1: Optional[str] = None, jq_power_l2: Optional[str] = None, jq_power_l3: Optional[str] = None):
jq_power_l1: Optional[str] = None,
jq_power_l2: Optional[str] = None,
jq_power_l3: Optional[str] = None):
self.jq_power = jq_power
self.jq_exported = jq_exported
self.jq_imported = jq_imported
Expand Down
2 changes: 1 addition & 1 deletion packages/modules/devices/json/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def update(self, response):
float(jq.compile(config.jq_power_l2).input(response).first()),
float(jq.compile(config.jq_power_l3).input(response).first())
]

if config.jq_imported is None or config.jq_exported is None:
imported, exported = self.sim_counter.sim_count(power)
else:
Expand Down
2 changes: 1 addition & 1 deletion packages/modules/devices/json/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def read_legacy_bat(ip_address: str, jq_power: str, jq_soc: str):
read_legacy(ip_address, bat.component_descriptor.configuration_factory(id=None, configuration=config))


def read_legacy_counter(ip_address: str, jq_power: str, jq_imported: str, jq_exported: str,
def read_legacy_counter(ip_address: str, jq_power: str, jq_imported: str, jq_exported: str,
jq_power_l1: str, jq_power_l2: str, jq_power_l3: str):
config = JsonCounterConfiguration(jq_power=jq_power,
jq_imported=None if jq_imported == "" else jq_imported,
Expand Down
3 changes: 2 additions & 1 deletion packages/modules/devices/json/device_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def test_device(monkeypatch, mock_value_store: Mock, requests_mock: requests_moc
def test_counter_powers(monkeypatch, mock_value_store: Mock, requests_mock: requests_mock.Mocker):
# setup
monkeypatch.setattr(FaultState, "store_error", Mock())
requests_mock.get("http://sample_host/sample_path", json={"power": 42, "power_l1": 11, "power_l2": 12, "power_l3": 13})
requests_mock.get("http://sample_host/sample_path",
json={"power": 42, "power_l1": 11, "power_l2": 12, "power_l3": 13})
device_config = Json(configuration=JsonConfiguration("http://sample_host/sample_path"))

# execution
Expand Down

0 comments on commit 6dbdcd1

Please sign in to comment.