Problem running unit tests

10 views
Skip to first unread message

Tom White

unread,
Nov 12, 2009, 1:57:43 PM11/12/09
to libc...@googlegroups.com
I'm trying to run the libcloud unit tests, but I'm not having any luck
(see stacktrace below). Any idea what I'm doing wrong? This is on Mac
OS X (10.5.8).

Thanks,
Tom

$ python setup.py test
running test
Traceback (most recent call last):
File "setup.py", line 55, in <module>
cmdclass = { 'test': TestCommand }
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py",
line 151, in setup
dist.run_commands()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 974, in run_commands
self.run_command(cmd)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 994, in run_command
cmd_obj.run()
File "setup.py", line 41, in run
tests = TestLoader().loadTestsFromNames(testfiles)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/unittest.py",
line 565, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/unittest.py",
line 541, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_ec2'

Alex Polvi

unread,
Nov 12, 2009, 2:02:22 PM11/12/09
to libc...@googlegroups.com
Tom,

On Thu, Nov 12, 2009 at 10:57 AM, Tom White <tom.e...@gmail.com> wrote:

I'm trying to run the libcloud unit tests, but I'm not having any luck
(see stacktrace below). Any idea what I'm doing wrong? This is on Mac
OS X (10.5.8).


What version of python are you running? We have ran into this problem in the past and I have not been able to reproduce it (python2.5).

Another option is to use a test runner, like "trial" to do this. Trial is part of twisted python, then you would run: trial test/ from the root libcloud dir.

-Alex

$ python setup.py test
running test
Traceback (most recent call last):
 File "setup.py", line 55, in <module>
   cmdclass = { 'test': TestCommand }
 File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py",
line 151, in setup
   dist.run_commands()
 File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 974, in run_commands
   self.run_command(cmd)
 File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 994, in run_command
   cmd_obj.run()
 File "setup.py", line 41, in run
   tests = TestLoader().loadTestsFromNames(testfiles)
 File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/unittest.py",
line 565, in loadTestsFromNames
   suites = [self.loadTestsFromName(name, module) for name in names]
 File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/unittest.py",
line 541, in loadTestsFromName
   parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_ec2'





--
co-founder, cloudkick.com
twitter.com/cloudkick
541 231 0624

Jeremy Orem

unread,
Nov 12, 2009, 2:05:35 PM11/12/09
to libcloud
I can reproduce the problem running OSX and python 2.5, however, it
works with OSX and python 2.6. I haven't looked in to what might be
causing the problem yet, but just wanted to confirm.

-Jeremy

On Nov 12, 11:02 am, Alex Polvi <po...@cloudkick.com> wrote:
> Tom,
>

Tom White

unread,
Nov 12, 2009, 2:18:30 PM11/12/09
to libc...@googlegroups.com
Yes, this is with Python 2.5. For some reason it can't find the
test.test_ec2 module (I observed that test.test_base is found) and
then it fails since the test module doesn't have a "test_ec2"
attribute.

Tom

Alex Polvi

unread,
Nov 12, 2009, 2:21:14 PM11/12/09
to libc...@googlegroups.com
Hmm, so this does not work for you?

$ cd Code/libcloud
$ python
Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import test.test_ec2
>>> test.test_ec2
<module 'test.test_ec2' from 'test/test_ec2.py'>

Maybe we have different python paths or something.

-Alex

Jeremy Orem

unread,
Nov 12, 2009, 2:27:47 PM11/12/09
to libcloud
Mine was failing on test_base, because I didn't have simplejson
installed. Most likely test_ec2 is failing on some import. I have a
feeling you'll find out what is wrong if you try:
>>> import test.test_ec2

-Jeremy
On Nov 12, 11:21 am, Alex Polvi <po...@cloudkick.com> wrote:
> Hmm, so this does not work for you?
>
> $ cd Code/libcloud
> $ python
> Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.>>> import test.test_ec2
> >>> test.test_ec2
>
> <module 'test.test_ec2' from 'test/test_ec2.py'>
>
> Maybe we have different python paths or something.
>
> -Alex
>
>
>
> On Thu, Nov 12, 2009 at 11:18 AM, Tom White <tom.e.wh...@gmail.com> wrote:
>
> > Yes, this is with Python 2.5. For some reason it can't find the
> > test.test_ec2 module (I observed that test.test_base is found) and
> > then it fails since the test module doesn't have a "test_ec2"
> > attribute.
>
> > Tom
>
> > On Thu, Nov 12, 2009 at 11:05 AM, Jeremy Orem <jeremy.o...@gmail.com>

Tom White

unread,
Nov 12, 2009, 2:32:48 PM11/12/09
to libc...@googlegroups.com
Importing test_ec2 was failing because there was no secrets file. I
noticed that there is a secrets.py-dist, and the problem goes away if
this is copied as secrets.py. Is the intent that secrets.py-dist is a
template file? We should add a note to this effect to the docs if so.

test_vcloud has a related problem, solved by adding the following to
the secrets file:

HOSTINGCOM_USER=''
HOSTINGCOM_SECRET=''

After doing this I can run the tests (but a couple fail).

Thanks,
Tom

Tom White

unread,
Nov 12, 2009, 4:12:03 PM11/12/09
to libc...@googlegroups.com
I've made changes to fix these problems here:
http://github.com/tomwhite/libcloud/commit/72ab7f8a6cb46c23e98cc0e02b7ac5051f53ba35

Cheers,
Tom

Jeremy Orem

unread,
Nov 12, 2009, 5:18:27 PM11/12/09
to libcloud
Thanks for the fix. I've pushed it to the master repository.

-Jeremy

On Nov 12, 1:12 pm, Tom White <tom.e.wh...@gmail.com> wrote:
> I've made changes to fix these problems here:http://github.com/tomwhite/libcloud/commit/72ab7f8a6cb46c23e98cc0e02b...
>
> Cheers,
> Tom
>
> On Thu, Nov 12, 2009 at 11:32 AM, Tom White <tom.e.wh...@gmail.com> wrote:
> > Importing test_ec2 was failing because there was no secrets file. I
> > noticed that there is a secrets.py-dist, and the problem goes away if
> > this is copied as secrets.py. Is the intent that secrets.py-dist is a
> > template file? We should add a note to this effect to the docs if so.
>
> > test_vcloud has a related problem, solved by adding the following to
> > the secrets file:
>
> > HOSTINGCOM_USER=''
> > HOSTINGCOM_SECRET=''
>
> > After doing this I can run the tests (but a couple fail).
>
> > Thanks,
> > Tom
>
Reply all
Reply to author
Forward
0 new messages