[issue17974] Migrate unittest to argparse

2013-08-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-08-29 Thread Roundup Robot

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 tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-08-29 Thread Antoine Pitrou

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-08-23 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-08-09 Thread Serhiy Storchaka

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 test.test_colorsys discover -v Lib/test/test_json/

But this looks as an unintentional and senseless ability.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-08-09 Thread Michael Foord

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.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-08-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is the patch good?

--
assignee:  -> serhiy.storchaka
keywords: +needs review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-15 Thread Serhiy Storchaka

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 unittest.main(failfast=False, argv=['prog', '-f']) caused an 
error, while unittest.main(failfast=True, argv=['prog', '-f']) and 
unittest.main(failfast=[], argv=['prog', '-f']) just had no any effect. Now all 
non-None casse cause an error. The same for catchbreak and buffer.

--
Added file: 
http://bugs.python.org/file30268/unittest_argparse_less_horrible_3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-15 Thread Michael Foord

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 
good. I'll try it out and confirm.

In general I agree with Antoine, the best way to improve the implementation of 
unittest.main is to provide a new discovery script (with supporting code that 
is then much easier to extend).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Serhiy Storchaka

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 in tests, I can clean the code more.

I suppose discovery mode doesn't make sense when unittest.main() is called from 
a test module (i.e. "./python Lib/test/test_bisect.py discover"). At least 
USAGE_FROM_MODULE did not mention this mode.

--
Added file: 
http://bugs.python.org/file30263/unittest_argparse_less_horrible.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Antoine Pitrou

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
unittest" as the lesser, undocumented option.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Michael Foord

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".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Serhiy Storchaka

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 changing the numerical 
level of verbosity?

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Michael Foord

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Antoine Pitrou

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Michael Foord

Michael Foord added the comment:

What's the benefit of this change?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17974] Migrate unittest to argparse

2013-05-14 Thread Antoine Pitrou

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: ezio.melotti, michael.foord, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Migrate unittest to argparse
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file30256/unittest_argparse.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com