Skip to content

Commit

Permalink
Merge pull request #50 from stdweird/detailed_import_failure
Browse files Browse the repository at this point in the history
Detailed import failure message
  • Loading branch information
Jens Timmerman committed Aug 23, 2016
2 parents c76b58b + 0a2da4b commit f73f56d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
3 changes: 2 additions & 1 deletion lib/vsc/install/commontest.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def _import(self, pkg):
try:
__import__(pkg)
except ImportError as e:
self.assertFalse(e, msg='import %s'%pkg)
log.debug("__path__ %s" % (["%s = %s" % (name, getattr(mod, '__path__', 'None')) for name, mod in sys.modules.items()]))
self.assertFalse(e, msg="import %s failed sys.path %s exception %s" % (pkg, sys.path, e))

self.assertTrue(pkg in sys.modules, msg='%s in sys.modules after import' % pkg)

Expand Down
23 changes: 11 additions & 12 deletions lib/vsc/install/shared_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _log(self, level, msg, args):

RELOAD_VSC_MODS = False

VERSION = '0.10.11'
VERSION = '0.10.12'

log.info('This is (based on) vsc.install.shared_setup %s' % VERSION)

Expand Down Expand Up @@ -704,7 +704,6 @@ class VscScanningLoader(ScanningLoader):

TEST_LOADER_MODULE = __name__

# pylint: disable=arguments-differ
def loadTestsFromModule(self, module, pattern=None):
"""
Support test module and function name based filtering
Expand Down Expand Up @@ -1115,7 +1114,7 @@ def run(self):
'url': '',
'dependency_links': [],
'install_requires': [],
'tests_require': [],
'tests_require': ['nose', 'mock'],
'setup_requires': [],
}

Expand Down Expand Up @@ -1218,6 +1217,15 @@ def parse_target(self, target, urltemplate=None):
new_target = {}
new_target.update(vsc_setup_klass.SHARED_TARGET)

if sys.version_info < (2, 7):
# py26 support dropped in 0.8, and the old versions don't detect enough
log.info('no prospector support in py26 (or older)')
else:
log.info('adding prospector to tests_require')
tests_requires = new_target.setdefault('tests_require', [])
tests_requires.extend(['prospector >= 0.12.1', 'pylint < 1.6.0'])


# update the cmdclass with ones from vsc_setup_klass
# cannot do this in one go, whne SHARED_TARGET is defined, vsc_setup doesn't exist yet
for name, klass in new_target['cmdclass'].items():
Expand Down Expand Up @@ -1425,15 +1433,6 @@ def action_target(package, *args, **kwargs):
install_requires = [
'setuptools',
]
if sys.version_info < (2, 7):
# py26 support dropped in 0.8, and the old versions don't detect enough
log.info('no prospector support in py26 (or older)')
else:
# For now, not enforcing propspector.
# It would complicate rpm creation too much.
# Should be re-added when the testing code is moved to vsc-testing
log.info('not enforcing prospector support. run "easy_install propspector" yourself')
# install_requires.append('prospector >= 0.11.7')

PACKAGE = {
'version': VERSION,
Expand Down
4 changes: 4 additions & 0 deletions lib/vsc/install/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ def assertEqual(self, a, b, msg=None):
def setUp(self):
"""Prepare test case."""
super(TestCase, self).setUp()

self.maxDiff = None
self.longMessage = True

self.orig_sys_stdout = sys.stdout
self.orig_sys_stderr = sys.stderr

Expand Down

0 comments on commit f73f56d

Please sign in to comment.