0

I have a project and into this project I have different apps.. The problem is, a specific app is another website inside the same project and uses different settings file.

When I run the tests separated, it works perfectly, when I try to run all tests together, the app which uses a different settings file fails..

Any idea how to fix it?

I tried to override the settings into setUp method as below:

for s in dir(settings_appA):
    if getattr(settings, s) == None:
        setattr(settings, s, getattr(settings_appA, s))

When I do it, works for the specific website but not for other apps..

Any idea?

Lara
  • 2,170
  • 6
  • 22
  • 43
  • The problem is - you are mixing projects and apps. Settings file belongs to a project, applications only define custom settings keys in the project-specific settings. This is how it should be. – alecxe Jul 02 '14 at 13:17

1 Answers1

1
./manage.py test <app1> --settings=settings1
./manage.py test <app2> --settings=settings2
trinchet
  • 6,753
  • 4
  • 37
  • 60
  • Hey @trinchet , thank you for the answer.. As I said before, when I run separated like you proposed, it works. The problem is that I have to run everything together .. I have more than 200 tests... – Lara Jul 02 '14 at 12:58
  • Ohh... I see, why you need to use different settings? maybe you just need to use different DBs, urls, etc... if so, you can code you own DjangoTestSuiteRunner https://docs.djangoproject.com/en/1.5/topics/testing/advanced/ – trinchet Jul 02 '14 at 13:13