Skip to content

Commit

Permalink
test: Silence false inconsistent-return-statements
Browse files Browse the repository at this point in the history
pylint 2.17.4 complains:

```
************* Module tests.integration.test_recoverable_problem
tests/integration/test_recoverable_problem.py:34:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
************* Module tests.integration.test_signal_crashes
tests/integration/test_signal_crashes.py:1175:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
```

Silence those false positives.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
  • Loading branch information
bdrung authored and schopin-pro committed Aug 8, 2023
1 parent bab7428 commit 0caef9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/integration/test_recoverable_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def setUp(self):
self.env["APPORT_REPORT_DIR"] = self.report_dir
self.datadir = get_data_directory()

# False positive return statement for unittest.TestCase.fail
# See https://github.com/pylint-dev/pylint/issues/4167
# pylint: disable-next=inconsistent-return-statements
def _wait_for_report(self):
seconds = 0
while seconds < 10:
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_signal_crashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,9 @@ def test_wait_for_core_file_timeout(self, sleep_mock, process_mock, exists_mock)
sleep_mock.assert_called_with(0.1)
self.assertEqual(sleep_mock.call_count, 600)

# False positive return statement for unittest.TestCase.fail
# See https://github.com/pylint-dev/pylint/issues/4167
# pylint: disable-next=inconsistent-return-statements
def wait_for_gdb_child_process(self, gdb_pid: int, command: str) -> psutil.Process:
"""Wait until GDB execv()ed the child process."""
gdb_process = psutil.Process(gdb_pid)
Expand Down

0 comments on commit 0caef9a

Please sign in to comment.