On 01/18/2010 09:58 PM, Shawn Milochik wrote: > On Jan 18, 2010, at 3:50 PM, Olivier Guilyardi wrote: > >> On 01/18/2010 08:59 PM, Shawn Milochik wrote: >>> Here's a fantastic resource. It's what I used to switch to this >>> methodology. It talks you through exactly how to do this. >>> >>> http://ericholscher.com/blog/2008/nov/4/introduction-pythondjango-testing-basic-unit-tests/ >> Oh yes, I found this one. >> >> The following doesn't work in my case (quoted from the page you cite): >> >> "Unit tests are a lot easier to import than doctests. You simply do a from >> <filename> import <testnames>. I named my unit test file unittst.py, and >> python >> will import that from the current directory. You are importing the test >> classes >> that you defined in your file. So I could have as easily put from unittest >> import TestBasic and it would work. Using the import * syntax allows us to >> add >> more tests to the file later and not have to edit it. " >> > > Then what does your tests/__init__.py look like? > > Mine looks like this: > > from address_tests import * > from random_tests import * > from other_tests import * > > #where the tests folder contains address_tests.py, random_tests.py, and > other_tests.py.
$ cat tests/__init__.py from model_tests import * $ find tests tests tests/model_tests.py tests/__init__.py Django doesn't see my test cases unless I move tests/model_tests.py to tests.py. One thing though: the tests directory (or tests.py if I revert it) is not at the root of a project, it's located in an application that I'm developing. -- Olivier
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.