paulocheque / django-dynamic-fixture

A complete library to create dynamic model instances for testing purposes.
http://django-dynamic-fixture.readthedocs.io/
Other
391 stars 67 forks source link

DDF setup plugin doesn't work when using Buildout #25

Closed michaelmior closed 9 years ago

michaelmior commented 11 years ago

My project currently uses Buildout and I haven't tested with a virtualenv-based project. But I noticed the DDF setup plugin actually imports the ddf_setup of the DDF setup plugin since django-dynamic-fixture appears first in sys.path.

Not quite sure what the best solution is to this yet.

michaelmior commented 11 years ago

Perhaps allowing --with-ddf-setup=import.path.for.ddf_setup?

michaelmior commented 11 years ago

Unfortunately I realized optparse doesn't allow arguments with optional values, so this can't be implemented without breaking existing code.

paulocheque commented 11 years ago

I did not understand completely the problem. But according to your messages, do you think it is possible fixing this change the order manually of the sys.path?

michaelmior commented 11 years ago

The issue is that my app comes after django-dynamic-fixture in sys.path. Because ddf_setup also exists as a module there, it gets loaded instead of my ddf_setup.py. Ideally there would be a solution which doesn't require changing sys.path. One solution would be to move the ddf_setup and queries plugins into some subfolder for nose plugins.

yES commented 10 years ago

This is not good idea to name package ddf_setup and trying to import file with same name. When you set NOSE_PLUGINS = ['ddf_setup.DDFSetup', ] django app first trying import my file ddf_setup.py that causes exception: ImproperlyConfigured: Nose plugin module "ddf_setup" does not define a "DDFSetup" It whould be to set different names for package with plugin and custom file.

paulocheque commented 10 years ago

Amazing feedback yES! I hope we can change this in the future! If you guys have some pull request I will be happy to merge it.