Circular import between and models/

Bug #1373477 reported by Jason Hobbs on 2014-09-24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Jason Hobbs

Bug Description

r3070 introduced a circular import between src/maasserver/models/ and src/maasserver/ For some reason it doesn't show up in the normal unit tests, but it does if you run a subset of the unit tests:

ubuntu@maas-dev:~/upstream$ ./bin/test.maas /home/ubuntu/add-disk-erase-user-data/src/metadataserver/user_data/
nosetests /home/ubuntu/add-disk-erase-user-data/src/metadataserver/user_data/ --exclude=provisioningserver --exclude=maastesting --exclude=maascli --verbosity=1
Creating test database for alias 'default'...
ERROR: Failure: ImportError (cannot import name get_preseed_type_for)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/", line 411, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/ubuntu/add-disk-erase-user-data/src/metadataserver/user_data/tests/", line 17, in <module>
    from maasserver.preseed import get_preseed_context
  File "/home/ubuntu/upstream/src/maasserver/", line 35, in <module>
    from maasserver.clusterrpc.boot_images import get_boot_images_for
  File "/home/ubuntu/upstream/src/maasserver/clusterrpc/", line 20, in <module>
    from maasserver.models import BootResource
  File "/home/ubuntu/upstream/src/maasserver/models/", line 62, in <module>
    from maasserver.models.event import Event
  File "/home/ubuntu/upstream/src/maasserver/models/", line 29, in <module>
    from maasserver.models.node import Node
  File "/home/ubuntu/upstream/src/maasserver/models/", line 101, in <module>
    from maasserver.preseed import get_preseed_type_for
ImportError: cannot import name get_preseed_type_for

Ran 8 tests in 0.018s

FAILED (errors=1)
Destroying test database for alias 'default'...

Related branches

Changed in maas:
assignee: nobody → Jason Hobbs (jason-hobbs)
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
milestone: none → 1.7.0
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers