Skip to content

Commit

Permalink
Merge pull request #100 from freedomofpress/fix-lint
Browse files Browse the repository at this point in the history
Satisfy the linter!
  • Loading branch information
sssoleileraaa authored Jul 5, 2022
2 parents c4b4081 + cc45107 commit 3c9f5f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
4 changes: 1 addition & 3 deletions tests/disk/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,7 @@ def test_luks_precheck_encrypted_luks_error(mocked_call, capsys, mocker):

single_partition_lsblk_output = b"disk\npart\n"
mocker.patch("subprocess.check_output", return_value=single_partition_lsblk_output)
mocker.patch(
"subprocess.run", side_effect=CalledProcessError(1, "run")
)
mocker.patch("subprocess.run", side_effect=CalledProcessError(1, "run"))

with pytest.raises(SystemExit):
action.check_luks_volume()
Expand Down
12 changes: 3 additions & 9 deletions tests/print/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ def test_install_printer_ppd_error_no_driver(mocker):
submission = export.SDExport("testfile", TEST_CONFIG)
action = PrintExportAction(submission)
mocked_exit = mocker.patch.object(submission, "exit_gracefully", return_value=0)
mocker.patch(
"subprocess.run", side_effect=CalledProcessError(1, "run")
)
mocker.patch("subprocess.run", side_effect=CalledProcessError(1, "run"))

action.install_printer_ppd(
"usb://HP/LaserJet%20Pro%20M404-M405?serial=A00000A000000"
Expand All @@ -120,9 +118,7 @@ def test_install_printer_ppd_error_not_supported(mocker):
submission = export.SDExport("testfile", TEST_CONFIG)
action = PrintExportAction(submission)
mocked_exit = mocker.patch.object(submission, "exit_gracefully", return_value=0)
mocker.patch(
"subprocess.run", side_effect=CalledProcessError(1, "run")
)
mocker.patch("subprocess.run", side_effect=CalledProcessError(1, "run"))

action.install_printer_ppd("usb://Not/Supported?serial=A00000A000000")

Expand All @@ -133,9 +129,7 @@ def test_setup_printer_error(mocker):
submission = export.SDExport("testfile", TEST_CONFIG)
action = PrintExportAction(submission)
mocked_exit = mocker.patch.object(submission, "exit_gracefully", return_value=0)
mocker.patch(
"subprocess.run", side_effect=CalledProcessError(1, "run")
)
mocker.patch("subprocess.run", side_effect=CalledProcessError(1, "run"))

action.setup_printer(
"usb://Brother/HL-L2320D%20series?serial=A00000A000000",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,14 @@ def test_safe_check_call(capsys, mocker):
submission.safe_check_call(
["python3", "-c", "import sys;sys.stderr.write('hello')"],
expected_message,
ignore_stderr_startswith=b'hello',
ignore_stderr_startswith=b"hello",
)

with pytest.raises(SystemExit) as sysexit:
submission.safe_check_call(
["python3", "-c", "import sys;sys.stderr.write('hello\n')"],
expected_message,
ignore_stderr_startswith=b'world',
ignore_stderr_startswith=b"world",
)

assert sysexit.value.code == 0
Expand Down

0 comments on commit 3c9f5f3

Please sign in to comment.