Skip to content

Commit

Permalink
handle CI errors (to be squashed)
Browse files Browse the repository at this point in the history
Signed-off-by: Plamen Dimitrov <[email protected]>
  • Loading branch information
pevogam committed Oct 16, 2024
1 parent 766debe commit 44a24d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
7 changes: 4 additions & 3 deletions aexpect/remote_door.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

# disable import issues from optional dependencies or remote extra imports using
# pylint: disable=E0401,C0415,W0212
# disable too-many-* as we need them pylint: disable=R0912,R0913,R0914,R0915,C0302
# disable too-many/few-* as we need them pylint: disable=R0903,R0912,R0913,R0914,R0915,R0917,C0302
# ..todo:: we could reduce the disabled issues after more significant refactoring

import os
Expand Down Expand Up @@ -82,11 +82,12 @@
import Pyro4
# Pyro5 compatibility does not support submodules so we need separate handling
class Server: # noqa: E301
"""Dummy class to replace a Pyro5 server."""
def __init__(self):
self.__dict__ = {}
server = Server()
server.expose = Pyro4.expose
server.is_private_attribute = Pyro4.util.is_private_attribute
server.expose = Pyro4.expose # pylint: disable=W0201
server.is_private_attribute = Pyro4.util.is_private_attribute # pylint: disable=W0201
# noinspection PyPackageRequirements
from Pyro4 import naming as nameserver
nameserver.start_ns = nameserver.startNS
Expand Down
20 changes: 10 additions & 10 deletions tests/test_remote_door.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Copyright: Intra2net AG and aexpect contributors
# Author: Plamen Dimitrov <[email protected]>
#
# selftests pylint: disable=C0111,C0111,W0613,R0913
# selftests pylint: disable=C0111,C0111,W0613,R0913,E1101

import os
import glob
Expand All @@ -28,14 +28,14 @@


# noinspection PyUnusedLocal
def _local_login(client, host, port, username, password, prompt,
def _local_login(_client, host, port, username, password, prompt,
linesep="\n", log_filename=None, log_function=None,
timeout=10, internal_timeout=10, interface=None):
return RemoteSession("sh", prompt=prompt, client=client)
return RemoteSession("sh", prompt=prompt, client=_client)


# noinspection PyUnusedLocal
def _local_copy(address, client, username, password, port, local_path,
def _local_copy(address, _client, username, password, port, local_path,
remote_path, limit="", log_filename=None, log_function=None,
verbose=False, timeout=600, interface=None, filesize=None,
directory=True):
Expand All @@ -54,11 +54,11 @@ def setUp(self):

self.has_remote_objects = hasattr(remote_door, "Pyro4")
if self.has_remote_objects:
self.Pyro4 = mock.patch(remote_door.Pyro4)
self.pyro = mock.patch(remote_door.Pyro4)
self.server = mock.patch(remote_door.server)
self.nameserver = mock.patch(remote_door.nameserver)
else:
self.Pyro4 = remote_door.Pyro4 = mock.MagicMock()
self.pyro = remote_door.Pyro4 = mock.MagicMock()
self.server = remote_door.server = mock.MagicMock()
self.nameserver = remote_door.nameserver = mock.MagicMock()

Expand All @@ -75,7 +75,7 @@ def tearDown(self):
self.session.close()

if self.has_remote_objects:
self.Pyro4.stop()
self.pyro.stop()
self.server.stop()
self.nameserver.stop()
else:
Expand Down Expand Up @@ -172,8 +172,8 @@ def test_get_remote_object(self):
"""Test that a remote object can be retrieved properly."""
self.session = mock.MagicMock(name='session')
self.session.client = "ssh"
disconnect = self.Pyro4.errors.PyroError = Exception
self.Pyro4.Proxy.side_effect = [disconnect("no such object"), mock.DEFAULT]
disconnect = self.pyro.errors.PyroError = Exception
self.pyro.Proxy.side_effect = [disconnect("no such object"), mock.DEFAULT]
self.session.get_output.return_value = "Local object sharing ready\n"
self.session.get_output.return_value += "RESULT = None\n"

Expand Down Expand Up @@ -242,7 +242,7 @@ def test_import_remote_exceptions(self):
"aexpect.remote.LoginError",
"aexpect.remote.TransferError"]
remote_door.import_remote_exceptions(preselected_exceptions)
register_method = self.Pyro4.util.SerializerBase.register_dict_to_class
register_method = self.pyro.util.SerializerBase.register_dict_to_class
self.assertEqual(len(register_method.mock_calls), 3)

def get_first_arg(call):
Expand Down

0 comments on commit 44a24d9

Please sign in to comment.