[issue17217] Fix test discovery for test_format.py on Windows

2013-02-22 Thread Zachary Ware

Zachary Ware added the comment:

Your patch is certainly much simpler and more effective than mine; consider 
mine withdrawn.  I didn't take the simple step of figuring out exactly where 
the problem was happening and was just trying to fix the issue without changing 
anything in the actual testsoops :-S

I'll raise other issues about moving replace_stdout and unittest verbosity soon.

--

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



[issue17217] Fix test discovery for test_format.py on Windows

2013-02-22 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 831be7dc260a by Ezio Melotti in branch '3.2':
#17217: fix UnicodeEncodeErrors errors in test_format by printing ASCII only.
http://hg.python.org/cpython/rev/831be7dc260a

New changeset 3eb693462891 by Ezio Melotti in branch '3.3':
#17217: merge with 3.2.
http://hg.python.org/cpython/rev/3eb693462891

New changeset 562ba95dd4c9 by Ezio Melotti in branch 'default':
#17217: merge with 3.3.
http://hg.python.org/cpython/rev/562ba95dd4c9

--
nosy: +python-dev

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



[issue17217] Fix test discovery for test_format.py on Windows

2013-02-22 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
assignee:  - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue17217] Fix test discovery for test_format.py on Windows

2013-02-20 Thread Ezio Melotti

Ezio Melotti added the comment:

In order to fix test discovery on Windows the attached patch should be enough.

There are two somewhat unrelated issues though:
1) moving replace_stdout to test.support (and possibly turn it into a context 
manager/decorator);
2) use unittest verbosity to control the output of test_format instead of 
test.support.verbose;

Apparently there's no API to access the unittest verbosity level, so that would 
be a new feature request.

--
Added file: http://bugs.python.org/file29132/issue17217.diff

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



[issue17217] Fix test discovery for test_format.py on Windows

2013-02-16 Thread Zachary Ware

New submission from Zachary Ware:

test_format is an interesting case in the ongoing test discovery conversion.  
It already uses unittest.main(), but still has test_main(), and discovery seems 
to work fine on Linux.  On Windows, however, test_format and test_non_ascii 
both fail with a UnicodeEncodeError.  Running under regrtest, this doesn't 
happen because of regrtest's replace_stdout() function.  Thus, running python 
-m test.test_format with the following patch works:

diff -r 168efd87e051 Lib/test/test_format.py
--- a/Lib/test/test_format.py   Fri Feb 15 23:38:23 2013 +0200
+++ b/Lib/test/test_format.py   Sat Feb 16 15:14:52 2013 -0600
@@ -325,9 +325,7 @@
 self.assertIs({0:5s}.format(text), text)


-def test_main():
-support.run_unittest(FormatTest)
-
-
 if __name__ == __main__:
+from test.regrtest import replace_stdout
+replace_stdout()
 unittest.main()


Doing the same in a setUpModule function would work for both running the module 
and for a unittest discover command, but it would also cause replace_stdout() 
to be called twice when running under regrtest, which I don't think would be 
especially good.

The attached patch is one possible solution that I've come up with.  It moves 
replace_stdout from regrtest to support, and adds a running_under_regrtest 
flag to support that regrtest sets to True.  test_format then checks 
support.running_under_regrtest in setUpModule to determine whether to run 
support.replace_stdout.

--
components: Tests
files: test_format_discovery.diff
keywords: patch
messages: 182248
nosy: brett.cannon, ezio.melotti, zach.ware
priority: normal
severity: normal
status: open
title: Fix test discovery for test_format.py on Windows
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29093/test_format_discovery.diff

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