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

tornado 2.3: Test suite fails due to ImportWarnings #524

Closed
Arfrever opened this issue Jun 2, 2012 · 5 comments
Closed

tornado 2.3: Test suite fails due to ImportWarnings #524

Arfrever opened this issue Jun 2, 2012 · 5 comments

Comments

@Arfrever
Copy link

Arfrever commented Jun 2, 2012

tornado/test/runtests.py is now too strict. It should ignore ImportWarnings, which would occur for namespace packages generated by setuptools.

$ PYTHONPATH="." python2.7 tornado/test/runtests.py
Traceback (most recent call last):
  File "tornado/test/runtests.py", line 59, in <module>
    tornado.testing.main()
  File "/tmp/tornado-2.3/tornado/testing.py", line 381, in main
    unittest.main(defaultTest="all", argv=argv)
  File "/usr/lib64/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/usr/lib64/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/usr/lib64/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/usr/lib64/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib64/python2.7/unittest/loader.py", line 113, in loadTestsFromName
    test = obj()
  File "tornado/test/runtests.py", line 34, in all
    return unittest.defaultTestLoader.loadTestsFromNames(TEST_MODULES)
  File "/usr/lib64/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib64/python2.7/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/tmp/tornado-2.3/tornado/test/twisted_test.py", line 31, in <module>
    from twisted.internet.defer import Deferred
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 25, in <module>
    from twisted.python import log, failure, lockfile
  File "/usr/lib64/python2.7/site-packages/twisted/python/log.py", line 17, in <module>
    from zope.interface import Interface
  File "/usr/lib64/python2.7/site-packages/zope/__init__.py", line 2, in <module>
    import pkg_resources
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 2756, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 705, in subscribe
    callback(dist)
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 2756, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 2259, in activate
    map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 1848, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 1805, in _handle_ns
    loader = importer.find_module(packageName)
  File "/usr/lib64/python2.7/pkgutil.py", line 186, in find_module
    file, filename, etc = imp.find_module(subname, path)
ImportWarning: Not importing directory '/usr/lib64/python2.7/site-packages/peak': missing __init__.py
@bdarnell
Copy link
Member

bdarnell commented Jun 2, 2012

Hmm. It works for me. What packages do you need to have installed for this to happen? (i.e. what is "peak"? I don't see it on pypi). "pip freeze" output would be most helpful.

@Arfrever
Copy link
Author

Arfrever commented Jun 2, 2012

peak.util.decorators module is from http://pypi.python.org/pypi/DecoratorTools
If I rename peak directory, then the error (ImportWarning) occurs for another namespace package.

@bdarnell
Copy link
Member

bdarnell commented Jun 2, 2012

Hmm. Still can't reproduce. I tried the following:

$ virtualenv /tmp/testenv
$ source /tmp/testenv/bin/activate
$ pip install tornado twisted DecoratorTools
$ python -m tornado.test.runtests

and the tests passed.

@Arfrever
Copy link
Author

Arfrever commented Jun 2, 2012

Maybe pip differently installs packages.
Try:

mkdir /usr/lib/python2.7/site-packages/a.egg-info
echo a > /usr/lib/python2.7/site-packages/a.egg-info/namespace_packages.txt
mkdir /usr/lib/python2.7/site-packages/a
cd /tmp
wget http://pypi.python.org/packages/source/t/tornado/tornado-2.3.tar.gz
tar -xzf tornado-2.3.tar.gz
/usr/bin/python2.7 -m tornado.test.runtests

It fails with ImportWarning: Not importing directory '/usr/lib/python2.7/site-packages/a': missing __init__.py.

@Arfrever
Copy link
Author

Arfrever commented Jun 2, 2012

Run cd tornado-2.3 after tar -xzf tornado-2.3.tar.gz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants