diff --git a/CHANGELOG.md b/CHANGELOG.md index 74a61c7e9..57caee29c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ +## moler 1.32.1 + +### Improved +* Check if passed object is ConnectionObserver instance in MolerConnectionForSingleThreadRunner + ## moler 1.32.0 ### Added * add `ADDITIONAL_PARAMS` in device configuration +* add possibility use `single-threaded` runner for all ConnectionObservers ### Improved * Add more readable traceback diff --git a/README.md b/README.md index a4c8a9cfc..e3a7b9099 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![image](https://img.shields.io/badge/pypi-v1.32.0-blue.svg)](https://pypi.org/project/moler/) +[![image](https://img.shields.io/badge/pypi-v1.32.1-blue.svg)](https://pypi.org/project/moler/) [![image](https://img.shields.io/badge/python-2.7%20%7C%203.6%20%7C%203.7%20%7C%203.8-blue.svg)](https://pypi.org/project/moler/) [![Build Status](https://travis-ci.org/nokia/moler.svg?branch=master)](https://travis-ci.org/nokia/moler) [![Coverage Status](https://coveralls.io/repos/github/nokia/moler/badge.svg?branch=master)](https://coveralls.io/github/nokia/moler?branch=master) diff --git a/docs/source/conf.py b/docs/source/conf.py index b9951c61f..0cd565224 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,7 +24,7 @@ author = 'Nokia' # The short X.Y version -version = '1.32.0' +version = '1.32.1' # The full version, including alpha/beta/rc tags release = 'stable' diff --git a/moler/config/__init__.py b/moler/config/__init__.py index e58cc66ca..9333e1ba5 100644 --- a/moler/config/__init__.py +++ b/moler/config/__init__.py @@ -13,9 +13,9 @@ from moler.helpers import compare_objects from moler.exceptions import MolerException from moler.exceptions import WrongUsage -from . import connections as conn_cfg -from . import devices as dev_cfg -from . import loggers as log_cfg +from moler.config import connections as conn_cfg +from moler.config import devices as dev_cfg +from moler.config import loggers as log_cfg loaded_config = ["NOT_LOADED_YET"] diff --git a/moler/moler_connection_for_single_thread_runner.py b/moler/moler_connection_for_single_thread_runner.py index fdb6cdc77..b2e184dc5 100644 --- a/moler/moler_connection_for_single_thread_runner.py +++ b/moler/moler_connection_for_single_thread_runner.py @@ -10,9 +10,9 @@ __email__ = 'marcin.usielski@nokia.com' +import moler.connection_observer from moler.abstract_moler_connection import identity_transformation from moler.observer_thread_wrapper import ObserverThreadWrapper, ObserverThreadWrapperForConnectionObserver -from moler.connection_observer import ConnectionObserver from moler.threaded_moler_connection import ThreadedMolerConnection from moler.runner_single_thread import RunnerSingleThread import time @@ -119,10 +119,22 @@ def _create_observer_wrapper(self, observer_reference, self_for_observer): to a function. :return: Instance of wrapper. """ - if observer_reference is None or not isinstance(self_for_observer, ConnectionObserver): - otw = ObserverThreadWrapper( + if self._is_connection_observer_instance(self_for_observer) is True: + otw = ObserverThreadWrapperForConnectionObserver( observer=observer_reference, observer_self=self_for_observer, logger=self.logger) else: - otw = ObserverThreadWrapperForConnectionObserver( + otw = ObserverThreadWrapper( observer=observer_reference, observer_self=self_for_observer, logger=self.logger) return otw + + def _is_connection_observer_instance(self, self_for_observer): + """ + Check if argument is an instance of subclass of ConnectionObserver. + :param self_for_observer: object to check. + :return: True if observer_reference is a subclass of ConnectionObserver, False otherwise. + """ + if self_for_observer is None: + return False + if isinstance(self_for_observer, moler.connection_observer.ConnectionObserver): + return True + return False diff --git a/setup.py b/setup.py index 4dde0d682..34ebf240e 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name='moler', # Required - version='1.32.0', # Required + version='1.32.1', # Required description='Moler is library to help in building automated tests', # Required long_description=long_description, # Optional long_description_content_type='text/markdown', # Optional (see note above) diff --git a/test/integration/test_io_raw_ssh.py b/test/integration/test_io_raw_ssh.py index ea43781ee..ad4e5d30d 100644 --- a/test/integration/test_io_raw_ssh.py +++ b/test/integration/test_io_raw_ssh.py @@ -16,6 +16,10 @@ import pytest import mock import threading +import sys + + +pytestmark = pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4 or higher") def test_can_create_passive_sshshell_connection_using_same_api(passive_sshshell_connection_class):