🥚 🎡 release 0.0.6. fix #6

This commit is contained in:
chfw 2018-11-07 07:25:37 +00:00
parent 8d1af6e0ab
commit 38531382cb
8 changed files with 37 additions and 24 deletions

View File

@ -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
--------------------------------------------------------------------------------

View File

@ -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:

View File

@ -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 ---------------------------------------------------

View File

@ -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: []

View File

@ -1,2 +1,2 @@
__version__ = "0.0.5"
__version__ = "0.0.6"
__author__ = "C.W."

View File

@ -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):

View File

@ -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 = (

View File

@ -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():