Antoine Pitrou added the comment:
I think this should be committed. This is the first step in making command-line
args easily customizable (e.g. by exposing the parsers as a public API in
TestProgram).
--
___
Python tracker rep...@bugs.python.org
Roundup Robot added the comment:
New changeset 340f45374cf5 by Serhiy Storchaka in branch 'default':
Issue #17974: Switch unittest from using getopt to using argparse.
http://hg.python.org/cpython/rev/340f45374cf5
--
nosy: +python-dev
___
Python
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17974
Changes by Martin Panter vadmium...@gmail.com:
--
nosy: +vadmium
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17974
___
___
Python-bugs-list
Michael Foord added the comment:
The patch looks like an improvement. Does it maintain the ability to pass the
discovery arguments positionally and by keyword? If so then it can go in. I
like the improved error reporting for nonsenical input to unittest.main.
--
Serhiy Storchaka added the comment:
Does it maintain the ability to pass the discovery arguments positionally and
by keyword?
Yes, of course. Only such command line are not supported more:
./python Lib/test/test_colorsys.py discover -v Lib/test/test_json/
or
./python -m
Serhiy Storchaka added the comment:
Is the patch good?
--
assignee: - serhiy.storchaka
keywords: +needs review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17974
___
Michael Foord added the comment:
Discovery from a module importing main doesn't make sense (although from a
*script* importing main it does).
So long as python -m unittest -v continues to launch discovery, and the
positional argument form of discovery still works, then the new patch looks
Serhiy Storchaka added the comment:
Here is other variant of patch, even less horrible. However it introduces some
incompatibility:
1. Discovery mode now works only when module==None (i.e. from -m unittest).
It is only case for which it was documented.
2. Previously
New submission from Antoine Pitrou:
Attached patch migrates unittest to argparse.
This doesn't make discover handling much saner, given the awful way it's
originally implemented.
--
components: Library (Lib)
files: unittest_argparse.patch
keywords: patch
messages: 189212
nosy:
Michael Foord added the comment:
What's the benefit of this change?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17974
___
___
Antoine Pitrou added the comment:
I was considering making it possible to customize command-line options, as
requested by Guido, and it's better to expose the modern API rather than the
more obsolete one.
--
___
Python tracker
Michael Foord added the comment:
Ok, feel free to reimplement discovery command line handling if it can be done
in a compatible-but-less-horrible way. Anyway, the patch looks fine and a
couple of minor cleanups in there.
--
___
Python tracker
Serhiy Storchaka added the comment:
I don't see much sense in this modernization, while the code does not use the
capabilities of argparse (and even optparse). Why
USAGE_AS_MAIN/USAGE_FROM_MODULE/etc exist, why help is not generated
automatically? Why -v/-q store boolean flags instead of
Michael Foord added the comment:
Test discovery and new options (buffer, failfast etc) were bolted onto an old
and ugly design. Yes the code could use an overhaul and rebuilding from scratch
- but doing that whilst remaining fully compatible with all the existing usage
patterns is difficult.
Changes by Barry A. Warsaw ba...@python.org:
--
nosy: +barry
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17974
___
___
Python-bugs-list mailing
Antoine Pitrou added the comment:
Ok, feel free to reimplement discovery command line handling if it can
be done in a compatible-but-less-horrible way.
I don't think it's possible. Best way forward would be to provide a
pytest utility that does discovery automatically, and leave python -m
Serhiy Storchaka added the comment:
Here is a patch which reimplement discovery command line handling in a
i-hope-in-compatible-but-less-horrible way (and fixes some bugs). It is
horrible still, but I doubt how many changes can I do without breaking
compatibility. If _do_discovery() used only
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +berker.peksag
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17974
___
___
19 matches
Mail list logo