Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detailed import failure message #50

Merged
merged 5 commits into from
Aug 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still needed for the pylint on jenkins. Maybe we should set a tests_require for the pylint version?

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