Tuesday, July 31, 2012

Re: Weird test-behaviour in combination with localization

Ok, so I fixed my problem, but i have the feelings this cant really be a longterm solution ^^. If i create my own testsuite and skip all django-apps, the tests pass, if i comment them in, they wont run (With the above error). is there a possibility django changes the language-settings somehow within its own tests, which affect my other tests?


On Tuesday, July 31, 2012 9:21:28 PM UTC+2, Andre Schemschat wrote:
Hey together,
I was just writing some tests for my views and i stumbled upon a localization error, which i cant figure out :/
I have a test that checks the form-validation returnes the correct errors-messages for specific input data. Basicly what i feed to the view are the field-names and their values and in return i get a json-string with the error-messages for the fields.
This works fine, if i just run the tests for that specific view. (Result is something like {'fielda':'Dieses Feld ist zwingend erforderlich.'}, where 'Dieses Feld ist zwingend erforderlich.'=>'This field is required' in german). 
Now, if i run all tests, not just for that specific view, the test fails, because the view returnes {'fielda':'This field is required.'} instead of the german localization. I checked the settings.LANGUAGE_CODE-value in the view and in the test, in both cases it is de-de.
Any ideas, why my test is fine if it runs alone and fails when all tests of the project (including the django-ones) are run? Im fresh out of ideas and a little bit puzzled :D

Greetings & Thanks,
Andre

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

No comments:

Post a Comment