Skip to content

Commit a03d6d3

Browse files
committed
FIX: tests can access private members
1 parent d98e2d8 commit a03d6d3

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ line-length = 127
186186
indent-width = 4
187187

188188
[tool.ruff.lint.per-file-ignores]
189-
"tests/*" = ["D101", "UP031", "ARG002", "ANN001", "S101"]
189+
"tests/*" = ["D101", "UP031", "ARG002", "ANN001", "S101", "SLF001"]
190190
"ardupilot_methodic_configurator/backend_mavftp.py" = ["PGH004", "N801", "ANN001"]
191191
"ardupilot_methodic_configurator/backend_mavftp_example.py" = ["ANN001"]
192192
"ardupilot_methodic_configurator/tempcal_imu.py" = ["ANN001"]

tests/test_backend_filesystem_configuration_steps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ def test_get_seq_tooltip_text(self) -> None:
7777
def test_missing_new_value(self) -> None:
7878
file_info = {"forced_parameters": {"PARAM1": {"Change Reason": "Test reason"}}}
7979
with self.assertLogs(level="ERROR") as log:
80-
self.config_steps._ConfigurationSteps__validate_parameters_in_configuration_steps("test_file", file_info, "forced") # noqa: SLF001 pylint: disable=protected-access
80+
self.config_steps._ConfigurationSteps__validate_parameters_in_configuration_steps("test_file", file_info, "forced") # pylint: disable=protected-access
8181
assert any("New Value" in message for message in log.output)
8282

8383
def test_missing_change_reason(self) -> None:
8484
file_info = {"forced_parameters": {"PARAM1": {"New Value": "10"}}}
8585
with self.assertLogs(level="ERROR") as log:
86-
self.config_steps._ConfigurationSteps__validate_parameters_in_configuration_steps("test_file", file_info, "forced") # noqa: SLF001 pylint: disable=protected-access
86+
self.config_steps._ConfigurationSteps__validate_parameters_in_configuration_steps("test_file", file_info, "forced") # pylint: disable=protected-access
8787
assert any("Change Reason" in message for message in log.output)
8888

8989
def test_compute_parameters_with_invalid_expression(self) -> None:

tests/test_backend_flightcontroller.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,51 +120,51 @@ def test_download_params_via_mavftp() -> None:
120120

121121
def test_auto_detect_serial() -> None:
122122
fc = FlightController(reboot_time=7)
123-
serial_ports = fc._FlightController__auto_detect_serial() # noqa: SLF001 pylint: disable=protected-access
123+
serial_ports = fc._FlightController__auto_detect_serial() # pylint: disable=protected-access
124124
assert isinstance(serial_ports, list)
125125

126126

127127
def test_list_serial_ports() -> None:
128-
serial_ports = FlightController._FlightController__list_serial_ports() # noqa: SLF001 pylint: disable=protected-access
128+
serial_ports = FlightController._FlightController__list_serial_ports() # pylint: disable=protected-access
129129
assert isinstance(serial_ports, list)
130130

131131

132132
def test_list_network_ports() -> None:
133-
network_ports = FlightController._FlightController__list_network_ports() # noqa: SLF001 pylint: disable=protected-access
133+
network_ports = FlightController._FlightController__list_network_ports() # pylint: disable=protected-access
134134
assert isinstance(network_ports, list)
135135
assert "tcp:127.0.0.1:5760" in network_ports
136136

137137

138138
def test_request_banner() -> None:
139139
fc = FlightController(reboot_time=7)
140140
fc.connect(device="test")
141-
fc._FlightController__request_banner() # noqa: SLF001 pylint: disable=protected-access
141+
fc._FlightController__request_banner() # pylint: disable=protected-access
142142
# Since we cannot verify in the mock environment, we will just ensure no exceptions are raised
143143

144144

145145
def test_receive_banner_text() -> None:
146146
fc = FlightController(reboot_time=7)
147147
fc.connect(device="test")
148-
banner_text = fc._FlightController__receive_banner_text() # noqa: SLF001 pylint: disable=protected-access
148+
banner_text = fc._FlightController__receive_banner_text() # pylint: disable=protected-access
149149
assert isinstance(banner_text, list)
150150

151151

152152
def test_request_message() -> None:
153153
fc = FlightController(reboot_time=7)
154154
fc.connect(device="test")
155-
fc._FlightController__request_message(1) # noqa: SLF001 pylint: disable=protected-access
155+
fc._FlightController__request_message(1) # pylint: disable=protected-access
156156
# Since we cannot verify in the mock environment, we will just ensure no exceptions are raised
157157

158158

159159
def test_create_connection_with_retry() -> None:
160160
fc = FlightController(reboot_time=7)
161-
result = fc._FlightController__create_connection_with_retry(progress_callback=None, retries=1, timeout=1) # noqa: SLF001 pylint: disable=protected-access
161+
result = fc._FlightController__create_connection_with_retry(progress_callback=None, retries=1, timeout=1) # pylint: disable=protected-access
162162
assert result == ""
163163

164164

165165
def test_process_autopilot_version() -> None:
166166
fc = FlightController(reboot_time=7)
167167
fc.connect(device="test")
168168
banner_msgs = ["ChibiOS: 123", "ArduPilot"]
169-
result = fc._FlightController__process_autopilot_version(None, banner_msgs) # noqa: SLF001 pylint: disable=protected-access
169+
result = fc._FlightController__process_autopilot_version(None, banner_msgs) # pylint: disable=protected-access
170170
assert isinstance(result, str)

tests/test_backend_mavftp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def test_decode_ftp_ack_and_nack(self) -> None:
226226
]
227227

228228
for case in test_cases:
229-
ret = self.mav_ftp._MAVFTP__decode_ftp_ack_and_nack(case["op"]) # noqa: SLF001, pylint: disable=protected-access
229+
ret = self.mav_ftp._MAVFTP__decode_ftp_ack_and_nack(case["op"]) # pylint: disable=protected-access
230230
ret.display_message()
231231
log_output = self.log_stream.getvalue().strip()
232232
assert case["expected_message"] in log_output, (
@@ -245,7 +245,7 @@ def test_decode_ftp_ack_and_nack(self) -> None:
245245

246246
# Test for unknown error code in display_message
247247
op = self.ftp_operation(seq=22, opcode=OP_Nack, req_opcode=OP_ListDirectory, payload=bytes([255]))
248-
ret = self.mav_ftp._MAVFTP__decode_ftp_ack_and_nack(op, "ListDirectory") # noqa: SLF001, pylint: disable=protected-access
248+
ret = self.mav_ftp._MAVFTP__decode_ftp_ack_and_nack(op, "ListDirectory") # pylint: disable=protected-access
249249
ret.error_code = 125 # Set error code to 125 to trigger unknown error message
250250
ret.display_message()
251251
log_output = self.log_stream.getvalue().strip()

0 commit comments

Comments
 (0)