Re: Altering Settings in Tests leads to strange behaviour

2009-08-24 Thread Karen Tracey
jOn Tue, Aug 25, 2009 at 12:30 AM, Fergus  wrote:

>
> Running Django 1.1, and I get funny results in testing which indicate
> ordering.
>
> Two applications: A and B.
>
> A requires that you set settings.A_SETTING in your project's
> settings.py, which refers to an interface. It has a test case that
> modifies A_SETTING from its normal, default value in order to test a
> mock interface.
> B - by requiring A implicitly - requires settings.A_SETTING as A's
> code is called when using B
>
> Running tests for application B alone raises no errors.
> Running tests for application A raises an error on that test case if
> the updated A_SETTING in the test case is invalid.
>
> And the strange bit:
> Running tests for app A followed by B [manage.py test A B] causes an
> error in a test in application B as well as the one seen for A - and
> not when done in the opposite order. It appears the temporary test
> value for settings.A_SETTING is retained between test cases.
>
> Is this normal or expected in any way? Could it be due to importing
> settings at some strange place in app A or B? Am I just going MAD?
>

If you change settings during the test run, the changes will be seen by
subsequent tests.  Settings are not re-initialized between test methods,
cases, or tests of different applications.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Altering Settings in Tests leads to strange behaviour

2009-08-24 Thread Fergus

Running Django 1.1, and I get funny results in testing which indicate
ordering.

Two applications: A and B.

A requires that you set settings.A_SETTING in your project's
settings.py, which refers to an interface. It has a test case that
modifies A_SETTING from its normal, default value in order to test a
mock interface.
B - by requiring A implicitly - requires settings.A_SETTING as A's
code is called when using B

Running tests for application B alone raises no errors.
Running tests for application A raises an error on that test case if
the updated A_SETTING in the test case is invalid.

And the strange bit:
Running tests for app A followed by B [manage.py test A B] causes an
error in a test in application B as well as the one seen for A - and
not when done in the opposite order. It appears the temporary test
value for settings.A_SETTING is retained between test cases.

Is this normal or expected in any way? Could it be due to importing
settings at some strange place in app A or B? Am I just going MAD?

Thank you in advance,
Fergus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---