Support for unittest -k option

98 views
Skip to first unread message

François Freitag

unread,
Mar 11, 2019, 8:14:01 AM3/11/19
to django-d...@googlegroups.com
Hi Django Devs,

https://code.djangoproject.com/ticket/30245 suggests supporting Python
unittest `-k` option, to selectively run tests matching a keyword.

Currently, `-k` is the shorthand for `--keepdb` in Django.
A `--filter` flag was suggested to preserve backward compatibility.
Carlton suggested removing the `-k` option from `--keepdb` and reusing
it for unittest `-k`. That would follow unittest more closely, reduce
user confusion and ease maintenance.

What do you think is best? Do you see other options?

If re-taking the `-k` option for unittest `-k`, should a new shorthand
be introduced for `--keepdb`?

Thanks for your time,
François

Carlton Gibson

unread,
Mar 11, 2019, 8:19:08 AM3/11/19
to Django developers (Contributions to Django itself)
Thanks François,

Just on this, my thought is that if we don't follow `unittest` in changing `-k` for this, we have a steady trickle of confusion forever-more. 
I'd rather avoid that. 

C.

Adam Johnson

unread,
Mar 11, 2019, 9:19:51 AM3/11/19
to django-d...@googlegroups.com
+1 from me, I'm okay with the small breaking change to keep in-line with upstream unittest. Since it's restricted to tests, it's unlikely to break anyone's production site.

--
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@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/c54e52d2-012a-4852-9375-be37add55945%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Adam

Tobias McNulty

unread,
Mar 11, 2019, 9:20:37 AM3/11/19
to django-developers
Agreed it's probably better to make the switch now, and I'd be fine without a replacement shorthand alternative for --keepdb.

Cheers,

Tobias McNulty
Chief Executive Officer

tob...@caktusgroup.com
www.caktusgroup.com



--

Tim Graham

unread,
Mar 11, 2019, 10:41:47 AM3/11/19
to Django developers (Contributions to Django itself)
-kdb could be a suitable short option.

Dan Davis

unread,
Mar 11, 2019, 6:33:57 PM3/11/19
to Django developers (Contributions to Django itself)
I personally don't think a short-hand is needed.

Arthur Rio

unread,
Mar 11, 2019, 6:38:38 PM3/11/19
to django-d...@googlegroups.com, Dan Davis
I’m +1 on no short-hand. Also “kdb” is a little to close to “pdb” and doesn’t really make sense to me.

Arthur

Luke Plant

unread,
Mar 14, 2019, 2:43:29 AM3/14/19
to django-d...@googlegroups.com

I use `--keepdb` a lot, I never knew there was a shorthand and even know I do know wouldn't use it. For things like this I usually find it easy to remember the long option. So I'm +1 on changing it too, without a new shorthand for `--keepdb`. In the keyword usage `-k` must be followed by a keyword, so for people who did use it the shorthand, the old usage will break loudly which is good.

Luke

Reply all
Reply to author
Forward
0 new messages