Fix test directory location

Bug #843164 reported by klmitch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
High
Unassigned

Bug Description

We need to do this in the Swift repo too. The problem is that when you have multiple repos installed with 'sudo python setup.py develop' it's a crap shoot which one gets imported when you 'import test'.

Revision history for this message
klmitch (q-noreply) wrote :

How about putting in an __init__.py so you can import keystone.test?

Revision history for this message
klmitch (q-noreply) wrote :

You already have an `__init__.py` in there; which is actually what causes the `import test` ambiguities.

Another option, which seems more recommended by Pythonistas out there, is have all your tests (or at least the unit tests) at `<project>/test`. In Swift, we also have functional and probe tests, so I'm not sure what the team will decide. Maybe a `<project>/test`, `<project>/functest`, and `<project>/probetest` or something.

To show the problem, here's a run down on a fresh system:

    # First, just grab the source repos
    $ mkdir ~/example
    $ git clone <email address hidden>:gholt/keystone.git ~/example/keystone-repo
    $ bzr branch lp:swift ~/example/swift-repo

    # This shows that python comes with its own test package.
    $ cd ~ ; python -c 'import test ; print test'
    <module 'test' from '/usr/lib/python2.6/test/__init__.pyc'>

    # But now, once we install keystone for development, it takes over the new # test package.
    $ cd ~/example/keystone-repo ; sudo python setup.py develop
    $ cd ~ ; python -c 'import test ; print test'
    <module 'test' from '/home/gholt/example/keystone-repo/test/__init__.py'>

    # In this case, installing swift for development means it ends up with # keystone's test package.
    $ cd ~/example/swift-repo ; sudo python setup.py develop
    $ cd ~ ; python -c 'import test ; print test'
    <module 'test' from '/home/gholt/example/keystone-repo/test/__init__.pyc'>

    # If I remove keystone, swift now gets the test package.
    $ cd ~/example/keystone-repo ; sudo python setup.py develop -u
    $ cd ~ ; python -c 'import test ; print test'
    <module 'test' from '/home/gholt/example/swift-repo/test/__init__.py'>

    # If I remove swift, now we're back to way the things should've been.
    $ cd ~/example/swift-repo ; sudo python setup.py develop -u
    $ cd ~ ; python -c 'import test ; print test'
    <module 'test' from '/usr/lib/python2.6/test/__init__.pyc'>

Revision history for this message
klmitch (q-noreply) wrote :

Fixed. I'm not sure what to do with the tools folder though. Any elegant suggestions? Maybe wait for openstack-common...

Revision history for this message
klmitch (q-noreply) wrote :

Ah, I'm not sure on tools. Actually, I'm still not sure on tests either, but when you have a nice small project you can make these changes quickly. :)

I think I'm going to do even more searching, probably make an annoying blog post, and see what settles out of all that.

Revision history for this message
klmitch (q-noreply) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.