diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8493832..a2c5667 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Change log ================================================================================ +0.0.6 - 07/11/2018 +-------------------------------------------------------------------------------- + +Fixed +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. Revert the version 0.0.5 changes. Raise Import error and log the exception + 0.0.5 - 06/11/2018 -------------------------------------------------------------------------------- diff --git a/changelog.yml b/changelog.yml index 2b41253..d85c7aa 100644 --- a/changelog.yml +++ b/changelog.yml @@ -1,6 +1,12 @@ name: lml organisation: chfw releases: +- changes: + - action: Fixed + details: + - "Revert the version 0.0.5 changes. Raise Import error and log the exception" + date: 07/11/2018 + version: 0.0.6 - changes: - action: Fixed details: diff --git a/docs/source/conf.py b/docs/source/conf.py index 0ec7a42..3244eec 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -28,9 +28,9 @@ copyright = u'2017-2018 Onni Software Ltd.' author = u'C.W.' # The short X.Y version -version = u'0.0.5' +version = u'0.0.6' # The full version, including alpha/beta/rc tags -release = u'0.0.5' +release = u'0.0.6' # -- General configuration --------------------------------------------------- diff --git a/lml.yml b/lml.yml index 49373c6..8965338 100644 --- a/lml.yml +++ b/lml.yml @@ -4,9 +4,9 @@ organisation: "chfw" author: "C.W." contact: "wangc_2011@hotmail.com" company: "Onni Software Ltd." -version: "0.0.5" -current_version: "0.0.5" -release: "0.0.5" +version: "0.0.6" +current_version: "0.0.6" +release: "0.0.6" copyright_year: 2017-2018 license: New BSD dependencies: [] diff --git a/lml/_version.py b/lml/_version.py index 21b9c1f..9fd994c 100644 --- a/lml/_version.py +++ b/lml/_version.py @@ -1,2 +1,2 @@ -__version__ = "0.0.5" +__version__ = "0.0.6" __author__ = "C.W." diff --git a/lml/utils.py b/lml/utils.py index e9fc8b5..45c474d 100644 --- a/lml/utils.py +++ b/lml/utils.py @@ -12,7 +12,6 @@ import logging from json import JSONEncoder, dumps PY2 = sys.version_info[0] == 2 -PY36 = sys.version_info[0] == 3 and sys.version_info[1] >= 6 log = logging.getLogger(__name__) @@ -39,16 +38,13 @@ def json_dumps(keywords): def do_import(plugin_module_name): """dynamically import a module""" - if PY36: - try: - return _do_import(plugin_module_name) - except (ImportError, ModuleNotFoundError): # noqa: F821 - log.exception("failed to import %s", plugin_module_name) - else: - try: - return _do_import(plugin_module_name) - except ImportError: - log.exception("failed to import %s", plugin_module_name) + try: + return _do_import(plugin_module_name) + except ImportError: + log.exception( + "%s is abscent or cannot be imported", plugin_module_name + ) + raise def _do_import(plugin_module_name): diff --git a/setup.py b/setup.py index 72f8f68..1169be1 100644 --- a/setup.py +++ b/setup.py @@ -5,20 +5,22 @@ import os import sys import codecs from shutil import rmtree -from setuptools import setup, find_packages, Command + +from setuptools import Command, setup, find_packages + PY2 = sys.version_info[0] == 2 PY26 = PY2 and sys.version_info[1] < 7 NAME = 'lml' AUTHOR = 'C.W.' -VERSION = '0.0.5' +VERSION = '0.0.6' EMAIL = 'wangc_2011@hotmail.com' LICENSE = 'New BSD' DESCRIPTION = ( 'Load me later. A lazy plugin management system.' ) URL = 'https://github.com/chfw/lml' -DOWNLOAD_URL = '%s/archive/0.0.5.tar.gz' % URL +DOWNLOAD_URL = '%s/archive/0.0.6.tar.gz' % URL FILES = ['README.rst', 'CHANGELOG.rst'] KEYWORDS = [ 'python', @@ -46,8 +48,8 @@ EXTRAS_REQUIRE = {} # You do not need to read beyond this line PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi'.format( sys.executable) -GS_COMMAND = ('gs lml v0.0.5 ' + - "Find 0.0.5 in changelog for more details") +GS_COMMAND = ('gs lml v0.0.6 ' + + "Find 0.0.6 in changelog for more details") NO_GS_MESSAGE = ('Automatic github release is disabled. ' + 'Please install gease to enable it.') UPLOAD_FAILED_MSG = ( diff --git a/tests/test_utils.py b/tests/test_utils.py index e64211a..0f4a605 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,7 +1,7 @@ from mock import patch from lml.utils import do_import, json_dumps from lml.plugin import PluginManager -from nose.tools import eq_ +from nose.tools import eq_, raises def test_json_dumps(): @@ -27,10 +27,11 @@ def test_do_import_2(): eq_(plugin, themodule) +@raises(ImportError) @patch("lml.utils.log.exception") def test_do_import_error(mock_exception): do_import("non.exist") - mock_exception.assert_called_with("failed to import %s", "non.exist") + mock_exception.assert_called_with("No module named 'non'") def test_do_import_cls():