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

AttributeError: 'module' object has no attribute 'TestCase' #2578

Closed
7histle opened this issue Nov 14, 2012 · 3 comments
Closed

AttributeError: 'module' object has no attribute 'TestCase' #2578

7histle opened this issue Nov 14, 2012 · 3 comments
Milestone

Comments

@7histle
Copy link

7histle commented Nov 14, 2012

7histle@swamp:~/wrk$ uname -a
Linux swamp 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:32:50 UTC 2012 i686 i686 i386 GNU/Linux
7histle@swamp:~$ ipython --version
0.12.1
7histle@swamp:~$ cd /usr/local/lib/python2.7/dist-packages/django/utils
7histle@swamp:/usr/local/lib/python2.7/dist-packages/django/utils$ ipython
Traceback (most recent call last):
  File "/usr/bin/ipython", line 8, in <module>
    launch_new_instance()
  File "/usr/lib/python2.7/dist-packages/IPython/frontend/terminal/ipapp.py", line 402, in launch_new_instance
    app.initialize()
  File "<string>", line 2, in initialize
  File "/usr/lib/python2.7/dist-packages/IPython/config/application.py", line 84, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/IPython/frontend/terminal/ipapp.py", line 312, in initialize
    self.init_shell()
  File "/usr/lib/python2.7/dist-packages/IPython/frontend/terminal/ipapp.py", line 332, in init_shell
    ipython_dir=self.ipython_dir)
  File "/usr/lib/python2.7/dist-packages/IPython/config/configurable.py", line 318, in instance
    inst = cls(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/IPython/frontend/terminal/interactiveshell.py", line 183, in __init__
    user_module=user_module, custom_exceptions=custom_exceptions
  File "/usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 478, in __init__
    self.init_reload_doctest()
  File "/usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 662, in init_reload_doctest
    doctest_reload()
  File "/usr/lib/python2.7/dist-packages/IPython/utils/doctestreload.py", line 72, in doctest_reload
    import doctest
  File "/usr/lib/python2.7/doctest.py", line 2153, in <module>
    class DocTestCase(unittest.TestCase):
AttributeError: 'module' object has no attribute 'TestCase'

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    c.Application.verbose_crash=True

7histle@swamp:/usr/local/lib/python2.7/dist-packages/django/utils$ 

but if ....

7histle@swamp:/usr/local/lib/python2.7/dist-packages/django/utils$ cd
7histle@swamp:~$ ipython
Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
Type "copyright", "credits" or "license" for more information.

IPython 0.12.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: 

All ok

@Carreau
Copy link
Member

Carreau commented Nov 14, 2012

Could it be that django/utils contain a folder unittest that is imported instead of Python unit testing framework ?

@bfroehle
Copy link
Contributor

Yes, this is an unavoidable artifact of Python's import mechanism. The unittest module in your current directory is shadowing the system unittest module. There's nothing we can do here, unfortunately.

@Carreau
Copy link
Member

Carreau commented Nov 14, 2012

Ah, true, note for myself, you do not need to clone a github repo to browse it..

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

4 participants