Removed pointless script_path check.
If the file is missing, the install is bad and all bets are off.
This commit is contained in:
@ -18,15 +18,6 @@ class IrisSystemPermissionError(IrisSystemError):
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class IrisSystemMissingError(IrisSystemError):
|
||||
reason = "Not found"
|
||||
|
||||
def __init__(self, path):
|
||||
message = "Unable to access %s." % path.as_uri()
|
||||
logger.error(message)
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class IrisSystemThread(Thread):
|
||||
_USE_SUDO = True
|
||||
|
||||
@ -92,9 +83,6 @@ class IrisSystemThread(Thread):
|
||||
# @return boolean or exception
|
||||
##
|
||||
def can_run(self, *args, **kwargs):
|
||||
if not self.script_path.is_file():
|
||||
raise IrisSystemMissingError(self.script_path)
|
||||
|
||||
# Attempt an empty call to our system file
|
||||
command_bytes = b' '.join(self.get_command('check', non_interactive=True))
|
||||
process = subprocess.Popen(command_bytes, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import pathlib, pytest, subprocess
|
||||
from unittest import mock
|
||||
|
||||
from mopidy_iris.system import IrisSystemThread, IrisSystemMissingError, IrisSystemPermissionError
|
||||
from mopidy_iris.system import IrisSystemThread, IrisSystemPermissionError
|
||||
|
||||
|
||||
def test_system_sh_path():
|
||||
@ -50,18 +50,6 @@ def test_can_run_calls_script_check(popen_mock, process_mock):
|
||||
assert popen_mock.call_args[0][0].endswith(b"system.sh check")
|
||||
|
||||
|
||||
def test_can_run_script_missing_raises(tmp_path, caplog):
|
||||
iris_system = IrisSystemThread('foo', None)
|
||||
iris_system.script_path = tmp_path
|
||||
|
||||
with pytest.raises(IrisSystemMissingError) as excinfo:
|
||||
iris_system.can_run()
|
||||
|
||||
error_message = "Unable to access %s." % tmp_path.as_uri()
|
||||
assert error_message in str(excinfo.value)
|
||||
assert error_message in caplog.text
|
||||
|
||||
|
||||
def test_can_run_sudo_refused_raises(popen_mock, process_mock, caplog):
|
||||
process_mock.wait.return_value = 1
|
||||
iris_system = IrisSystemThread('foo', None)
|
||||
|
||||
Reference in New Issue
Block a user