Lara
Lara

Reputation: 2236

Django Test - How to run tests with different settings file for a specific app?

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?

Upvotes: 0

Views: 1779

Answers (1)

trinchet
trinchet

Reputation: 6933

./manage.py test <app1> --settings=settings1
./manage.py test <app2> --settings=settings2

Upvotes: 1

Related Questions