Hello everyone,
my name is Antonio, I'm using Django 1.9 and first of all I'd like to
thank you all contributors for the amazing framework I can work with.
I've just joined the django-dev mailing list to ask your opinion on a
really trivial patch I thought implementing.
Our backend server has with several apps: each app has its own test
package; each test package has several modules; each module has several
classes that has several methods.
In short, when we need to run tests we rarely run:
$ python manage.py test mydjangoapp.app_one.tests
More likely we run:
$ python manage.py test \
mydjangoapp.app_one.tests.test_module.TestClass.test_method_1
This happens especially when we need to investigate a regression, we
need to do a lot of writing because single tests are failing and we just
need to run that very test.
So I thought that it could be very useful a shortcut to get to the
"test_method_1" without writing the full CamelCased namespace all the
way down there.
I hacked together as proof a patch that adds an optional parameter to
the Django Command test.py:
$ python manage.py test --method-filter test_method_1
this can be a comma separated list of methods:
$ python manage.py test --method-filter test_method_1,test_method_2,...
Basically this patch rewrites the TestSuite object created in
DiscoverRunner.run_test(), filtering out method names that do not match
that list. Of course in case of name clashes two test methods from
different apps will run, but I don't find it an issue as we give
meaningful names to test methods. Also, there are many ways that such a
check could be implemented to give it flexibility (albeit simple).
So far I find it quite useful, but maybe because this patch solves a
very narrow use case (mine :-)) but I would like to know if 1) I missed
an already implemented way for such thing and if not 2) would you be
interested in a pr with such a patch.
Thanks for your comments, thoughts, suggestions, etc.
Sorry for the long post.
Regards,
Antonio
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/573A53C9.9090702%40storiepvtride.it.
For more options, visit https://groups.google.com/d/optout.