Hi,

+1 in general. One concern, and one idea:
>
> -- Backwards-incompatible changes --
> 
> * Some valid test structures in Django don't work with unittest2. For
>   instance, tests in `tests/__init__.py` don't match a patter than
>   unittest would recognize if running discovery on a module.
> 
I have a complex app with many tests; so many, that we felt the need to break 
the tests module into modules in a package. So we have 
        tests/test_frobnication.py
        tests/test_grobulation.py
etc., and
        tests/__init__.py
which imports them all.

It isn't quite clear to me how this applies to such a structure; it seems like 
I would need a special pattern, "tests.test_*.py" or some such. This, in turn, 
raises an idea: an app should be able to specify the discovery parameters for 
its own tests in the source, not just on the command line.

Just to be clear: In view of backwards-compatibility concerns, I don't think 
the load_tests protocol supported by unittest2 is enough for this. It should 
be much simpler, IMO; something like (pseudo code):

        try:
                from app import tests
                if hasattr(tests, 'root'):
                        set_discovery_root(tests.root)
                if hasattr(tests, 'pattern'):
                        set_discovery_pattern(tests.pattern)
        except ImportError:
                pass

This way, my case is handled simply by adding these lines into 
tests/__init__.py:

root=app.tests

Thanks,
        Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to