[issue16997] subtests

2013-01-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> If the API is more like self.assert*()'s "msg" parameter which appends 
> data to the usual exception, then it will be the same as what people
> are already used to.

It might be a good idea to allow both this and the arbitrary parameter kwargs, 
then.

> I'm not advocating independent addressability/runnability of subtests
> or the following approach, but a naive way to do this would be to run
> the TestCase as usual, but skip over any subTest blocks if the
> parameter data isn't an exact match.

Well, I still don't know how to skip a `with` block (short of raising an 
exception that will terminate the entire test).

--

___
Python tracker 

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



[issue14468] Update cloning guidelines in devguide

2013-01-28 Thread Ezio Melotti

Ezio Melotti added the comment:

I now divided and regrouped the FAQs in two sections, one "for everyone" and 
one "for core developers".
I'm not sure what to do with the "long-term development of features" section.  
One one hand I would prefer to move it away from committing.rst, but on the 
other hand it's a bit too long to be a single FAQ.  For now I left it there, 
but it could also be moved to the faq.rst page and possibly be broken in 
different subsections or separate FAQs.

I think what I have done so far can be committed, even though there are more 
improvements to do -- but those can be done later, so they shouldn't block 
this.  Please review the commits on bitbucket, and if they are OK I will 
collapse them and apply the resulting patch.

--

___
Python tracker 

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



[issue16997] subtests

2013-01-28 Thread Chris Jerdonek

Chris Jerdonek added the comment:

>> 1. Easily append data to failure messages coming from a block of asserts
>> 2. Continue running a test case after a failure from a block of asserts
>
>> Both of these seem independently useful and more generally applicable,
>
> I don't understand what you mean. 1 is pointless without 2 (if you let the 
> exception bubble up, unittest already deals with it). 2 without 1 doesn't 
> make much sense either (if you only want to silence an exception, a simple 
> try...except will suffice).

I'll explain.  (1) is useful without (2) because it lets you add information to 
the failure data for a group of asserts without having to use the "msg" 
parameter in every call to assert().  This is useful, for example, if you're 
testing a number of cases in a loop (with the current behavior of ending the 
test on first failure), and it's not clear from the default exception message 
which iteration of the loop failed.  Your original example is such a case 
(minus the part about continuing in case of failure).  This use case is 
basically the one addressed by Serhiy's suggestion in this message:

http://bugs.python.org/issue16997#msg180225

(2) is useful without (1) if you'd like to get information about more than one 
assertion failure in a TestCase (just as in your proposal), but the assertions 
aren't necessarily coming from a "parametrization" or different iterations of a 
loop.  With the proposed API, you'd do something like:

with self.subTest():
# First assertion
...
with self.subTest():
# Second assertion
...

The difference here is that I wouldn't call these "subtests," and you don't 
need parameter data to know which assertion is at fault.  The meaning here is 
more like "with self.continueTesting()".

> Also, changing the exception message might be confusing as readers expect the 
> displayed message to be exactly str(exc).

If the API is more like self.assert*()'s "msg" parameter which appends data to 
the usual exception, then it will be the same as what people are already used 
to.  Also see the "longMessage" attribute (which defaults to True), which 
separates the extra message data from the default exception message:

http://docs.python.org/dev/library/unittest.html#unittest.TestCase.longMessage

>> Alternatively, subtests could be made independently addressable and
>> runnable, but that route seems more challenging and less certain.
>
> I would say impossible, unless you know a way to run a `with` block in 
> isolation ;-)

I'm not advocating independent addressability/runnability of subtests or the 
following approach, but a naive way to do this would be to run the TestCase as 
usual, but skip over any subTest blocks if the parameter data isn't an exact 
match.

--

___
Python tracker 

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



[issue16979] Broken error handling in codecs.unicode_escape_decode()

2013-01-28 Thread Ezio Melotti

Ezio Melotti added the comment:

LGTM.
If you want to push it even further you could make a list of (input, expected) 
and call the check() in a loop.  That way it will also be easier to refactor 
if/when we add subtests (#16997).

--

___
Python tracker 

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



[issue17068] peephole optimization for constant strings

2013-01-28 Thread STINNER Victor

STINNER Victor added the comment:

> and realized this could be rewritten by the interpreter as:

Yeah, it could but it's tricky to implement it. The current peephole is 
implemented in C. You may first try to implement it using my astoptimizer 
project which is implemented in Python. At least to check if it's possible or 
not :-)

https://bitbucket.org/haypo/astoptimizer

astoptimizer only optimizes str%args if it succeed at compile time, so if all 
arguments are constant and no error is raised.

--

___
Python tracker 

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



[issue16509] sqlite3 docs do not explain check_same_thread

2013-01-28 Thread Thomas Kluyver

Changes by Thomas Kluyver :


--
nosy: +takluyver

___
Python tracker 

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



[issue4590] 2to3 strips trailing L for long iterals in two fixers

2013-01-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d5ee6d13af18 by Benjamin Peterson in branch '3.3':
fix long fixer docs (#4590)
http://hg.python.org/cpython/rev/d5ee6d13af18

New changeset 8b9910d8d27f by Benjamin Peterson in branch 'default':
merge 3.3 (#4590)
http://hg.python.org/cpython/rev/8b9910d8d27f

New changeset 6904e229833d by Benjamin Peterson in branch '2.7':
fix long fixer docs (#4590)
http://hg.python.org/cpython/rev/6904e229833d

--
nosy: +python-dev

___
Python tracker 

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



[issue16754] Incorrect shared library extension on linux

2013-01-28 Thread Sandro Mani

Sandro Mani added the comment:

So, from what I can see, historically the SO extension was taken from 
sysconfig.py, see [1] lines 24 and 60. Then, the CCompiler class got 
overhauled, and the value was hardcoded to ".so", see [2], but the 
"compiler.shared_lib_extension = SO" statement remained, presumably oversight. 
So technically, this is also affecting python 2.x, though in that case it does 
not make any difference, since python2 does not use versioned so-names for 
binary modules.

[1] 
http://hg.python.org/cpython/file/2802fb52e99b/Lib/distutils/unixccompiler.py
[2] http://hg.python.org/cpython/rev/7922d08426ca

--

___
Python tracker 

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



[issue17068] peephole optimization for constant strings

2013-01-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

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



[issue17015] mock could be smarter and inspect the spec's signature

2013-01-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Proof-of-concept patch. mock is ugly!

--
keywords: +patch
Added file: http://bugs.python.org/file28886/issue17015.patch

___
Python tracker 

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



[issue17068] peephole optimization for constant strings

2013-01-28 Thread Neal Norwitz

New submission from Neal Norwitz:

I was looking through code like this:

  foo = '%s%s%s' % ('https://', host, uri)

and realized this could be rewritten by the interpreter as:

  foo = 'https://%s%s' % (host, uri)

I tried to determine how much code this might affect, but it was pretty hard 
for me to come up with a decent regex to filter out all the false positives.  
There were too many hits to determine if this would be used often.

--
components: Interpreter Core
messages: 180885
nosy: nnorwitz
priority: normal
severity: normal
status: open
title: peephole optimization for constant strings
type: performance

___
Python tracker 

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



[issue17067] Examples in documentation for 3.x in 23.1.3.4. Deferred translations are rather weak

2013-01-28 Thread R. David Murray

R. David Murray added the comment:

Sorry, I didn't mean "computed at runtime", I meant defined in code where the _ 
call is *executed* at runtime, rather than at import time.

--

___
Python tracker 

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



[issue17067] Examples in documentation for 3.x in 23.1.3.4. Deferred translations are rather weak

2013-01-28 Thread R. David Murray

R. David Murray added the comment:

Thanks for your suggestion, but...

The example currently in the docs is exactly how we do deferred translation in 
the project I am currently working on.  Your example is much more complex, and 
I don't see the benefit of it.

Specifically, using the example in the docs you can easily mix deferred 
translations with non-deferred translations, which what you generally end up 
wanting to do in real code.  (You use deferred translation with strings that 
are defined at import time, as in the example, and non-deferred with strings 
that are computed at runtime.)

Perhaps there is a need for additional text about how this works in practice, 
including an example of switching the language dynamically during runtime.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-01-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue17067] Examples in documentation for 3.x in 23.1.3.4. Deferred translations are rather weak

2013-01-28 Thread Carsten Klein

New submission from Carsten Klein:

The examples for the topic presented are rather weak. In fact, they merely 
present do nothing replacements for an actually working, deferred localization 
mechanism or some sort of prototypical implementation thereof.

As such I propose that they be replaced with something more meaningful,
for example such as 


class DeferredTranslation(object):

def __init__(self, message, ...):

self.message = message

def __str__(self):

return gettext.translation(...).lgettext(self.message)


def _(message, ...):

return DeferredTranslation(message, ...)


MSG = _('localized message')


Or something else along that way other than the currently presented examples :D

--
assignee: docs@python
components: Documentation
messages: 180882
nosy: carsten.kl...@axn-software.de, docs@python
priority: normal
severity: normal
status: open
title: Examples in documentation for 3.x in 23.1.3.4. Deferred translations are 
rather weak
type: enhancement
versions: Python 3.3

___
Python tracker 

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



[issue17037] Use a test.support helper to wrap the PEP 399 boilerplate

2013-01-28 Thread Eric Snow

Eric Snow added the comment:

+1 on requires_accelerator().  It could also be used for individual test 
methods.  Similar decorators-as-methods could be added later, where 
appropriate, for other special cases, like handling the pickle situation 
described in #16817.

--

___
Python tracker 

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



[issue17037] Use a test.support helper to wrap the PEP 399 boilerplate

2013-01-28 Thread Eric Snow

Eric Snow added the comment:

FWIW, here's a little more explanation on my original thoughts, none of which 
I'm married to.

Most of the magic in my patch came messing with the globals (swap out the 
module and module attrs; add in the two new classes; ditch the original class). 
 That was a consequence of my remaining objectives.

I was also following the lead of decorators by having the the boilerplate 
before the test case definition rather than split up before and after.

Finally, I was trying to do it in a way that existing test cases, like 
TestOrderedDict, would need as little changes as possible.

This leads to one bit of boilerplate that I'm not a fan of: the whole 
self. thing.  For TestOrderedDict, it meant changing all uses of an 
OrderedDict global to self.collections.OrderedDict.  In fact, that was 
essentially the biggest motivation for the "magic" in the decorator.  However, 
I can live with the boilerplate--I'll just deal with the search-and-replace 
(not the end of the world).

--

___
Python tracker 

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



[issue17037] Use a test.support helper to wrap the PEP 399 boilerplate

2013-01-28 Thread Eric Snow

Eric Snow added the comment:

+1 to where Brett's taking this.  I really like having the PEP399Tests class 
encapsulating the various boilerplate parts, with some of them as methods, 
rather than trying to pack them all into one all-powerful decorator.

It would be worth raising an exception in 
``pep399_tests.create_test_cases(ExampleTest)`` if ExampleTest inherits from 
unittest.TestCase.  This is a simple thing that would help people get it right.

--

___
Python tracker 

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



[issue17066] Fix test discovery for test_robotparser.py

2013-01-28 Thread Zachary Ware

New submission from Zachary Ware:

Here's a fix for test_robotparser.py.  With this patch, the command 'python -m 
unittest discover Lib/test/ "test_*.py"' can actually be run--before the patch, 
test_robotparser's unique TestCase subclass causes unexpected errors for 
discovery.

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

___
Python tracker 

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



[issue16935] unittest should understand SkipTest at import time during test discovery

2013-01-28 Thread Zachary Ware

Zachary Ware added the comment:

Here's a patch that I believe nicely handles the raising of unittest.SkipTest 
at module level while doing test discovery.  It adds a _make_skipped_test 
function to unittest.loader, and an ``except case.SkipTest`` clause to 
TestLoader._find_tests.  For our own test package, this covers non-enabled 
resources as well.

Here's some example output:
"""
P:\cpython>python -m unittest discover -v Lib/test/ "test_curs*"
test_curses (unittest.loader.ModuleSkipped) ... skipped "Use of the 'curses' res
ource not enabled"

--
Ran 1 test in 0.001s

OK (skipped=1)
[102289 refs, 38970 blocks]
"""

--
keywords: +patch
Added file: http://bugs.python.org/file28884/issue16935.diff

___
Python tracker 

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



[issue16968] Fix test discovery for test_concurrent_futures.py

2013-01-28 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Whichever solution you pick for the "test" issue, I would at least add a code 
comment explaining that the test return value needs to be garbage collected and 
why, etc. and probably reference this issue.

> If anyone thinks the 'ReapedSuite' class (or a better named copy) could be 
> useful elsewhere,

Can you look at some of the other test modules' test_main() functions to see if 
the same pattern is used there (or look at other uses of reap_children(), etc)? 
 Then we would know what would be useful elsewhere.

--

___
Python tracker 

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



[issue17064] Fix sporadic buildbot failures for test_mailbox

2013-01-28 Thread R. David Murray

R. David Murray added the comment:

Ah, excellent.  I had missed that change.

This looks good then.  Hopefully it will work :)

--

___
Python tracker 

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



[issue17051] Memory leak in os.path.isdir under Windows

2013-01-28 Thread Brian Curtin

Brian Curtin added the comment:

Robert, thanks a lot for this fix and your contributor agreement. We're 
currently working on making it easier to submit the contributor agreement so 
you won't have to print it out and mail/fax/scan it...even though you already 
did it and you're now covered :)

--
nosy: +brian.curtin

___
Python tracker 

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



[issue16971] Refleaks in charmap decoder

2013-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue17065] Fix sporadic buildbot failures for test_winreg

2013-01-28 Thread Brian Curtin

Changes by Brian Curtin :


--
assignee:  -> brian.curtin

___
Python tracker 

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



[issue17065] Fix sporadic buildbot failures for test_winreg

2013-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Windows
nosy: +brian.curtin, stutzbach
stage:  -> patch review
type:  -> behavior
versions:  -Python 3.5

___
Python tracker 

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



[issue4590] 2to3 strips trailing L for long iterals in two fixers

2013-01-28 Thread Fábio M . Costa

Fábio M. Costa added the comment:

I believe that since this change the 2to3 documentation is outdated.

http://docs.python.org/2/library/2to3.html#2to3fixer-long
http://docs.python.org/2/library/2to3.html#2to3fixer-numliterals
http://docs.python.org/3/library/2to3.html#2to3fixer-long
http://docs.python.org/3/library/2to3.html#2to3fixer-numliterals

They could be updated to something like this:

long
Renames long to int. Check `numliterals` if you want to strip the L suffix on 
long literals.

numliterals
Converts octal and long literals into the new syntax.

Sorry if this is not the right channel to send documentation bug reports.

--
nosy: +fabiomcosta
versions: +Python 2.7 -3rd party

___
Python tracker 

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



[issue17051] Memory leak in os.path.isdir under Windows

2013-01-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 51173aba06eb by Serhiy Storchaka in branch '2.7':
Add Robert Xiao to Misc/ACKS for issue17051.
http://hg.python.org/cpython/rev/51173aba06eb

--

___
Python tracker 

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



[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-01-28 Thread Zack Weinberg

Zack Weinberg added the comment:

Contributor agreement resent by email.  Sorry for the delay.

--

___
Python tracker 

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



[issue17051] Memory leak in os.path.isdir under Windows

2013-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed. Thank you for patch.

--
resolution:  -> fixed
stage: commit 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



[issue17051] Memory leak in os.path.isdir under Windows

2013-01-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4deb294ff567 by Serhiy Storchaka in branch '2.7':
Issue #17051: Fix a memory leak in os.path.isdir() on Windows. Patch by Robert 
Xiao.
http://hg.python.org/cpython/rev/4deb294ff567

--
nosy: +python-dev

___
Python tracker 

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



[issue17064] Fix sporadic buildbot failures for test_mailbox

2013-01-28 Thread Jeremy Kloth

Jeremy Kloth added the comment:

Actually, the support functions (as of 3.3) attempt to work around the access 
errors.  They attempt to wait (to a point) for a successful operation before 
returning to the caller.  See issue15496 for details.

It is usually the case that the previous operation has not yet finished as to 
the cause of the access error.

--

___
Python tracker 

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



[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-01-28 Thread Michael Foord

Michael Foord added the comment:

Yes there are definitely room for documentation improvements.

And, yes - pulling the args out from some_mock.call_args "boils down to doing 
the matching by hand". You only do it when you *want* to do the matching by 
hand.

Your use case I would write:

from mock import Mock, ANY

...
my_mock(1, someobj(), bar=someotherobj())
my_mock.assert_called_with(1, ANY, bar=ANY)

args, kwargs = my_mock.call_args
foo = args[1]
bar = kwargs['bar']

self.assertIsInstance(bar, someobj)
self.assertIsInstance(foo, someotherobj)


It's a *little* cumbersome, but not something I do very often and not much 
extra code. I'm not sure that having "assert_called_with" return objects is an 
intuitive API either. (And having to specify tuple indices in a call to ANY is 
a bit odd too.)

Custom matchers that do the comparison in their __eq__ method would be another 
possibility:

class IsInstance(object):
  def __init__(self, Type):
self.Type = Type
  def __eq__(self, other):
   return isinstance(other, self.Type)


my_mock.assert_called_with(1, IsInstance(someobj), bar=IsInstance(someotherobj))

--

___
Python tracker 

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



[issue17049] calendar throws UnicodeEncodeError when locale is specified

2013-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

They moved from issue13539 which I have closed as a duplicate.

--

___
Python tracker 

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



[issue17049] calendar throws UnicodeEncodeError when locale is specified

2013-01-28 Thread Georg Brandl

Georg Brandl added the comment:

Serhiy: not sure why all those people belong in the nosy list.

--

___
Python tracker 

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



[issue17064] Fix sporadic buildbot failures for test_mailbox

2013-01-28 Thread R. David Murray

R. David Murray added the comment:

I think the support functions just ignore errors.  Isn't this going to continue 
to leave garbage on the buildbot filesystem without fixing the underlying 
problem?  I wonder if this is a variation on the usual Windows access errors, 
in which case perhaps that is the best we can do...

--
nosy: +r.david.murray

___
Python tracker 

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



[issue17065] Fix sporadic buildbot failures for test_winreg

2013-01-28 Thread Jeremy Kloth

New submission from Jeremy Kloth:

test_winreg fails sporadically on the AMD64 Windows buildbot.  Looking at the 
test, it appears that concurrent runs of the test would fail if different 
processes attempted to modify the test key at the same time.

The attached patch resolves this by using a per-process unique test key name 
using the process ID.

--
components: Tests
files: test_winreg.diff
keywords: patch
messages: 180863
nosy: jkloth
priority: normal
severity: normal
status: open
title: Fix sporadic buildbot failures for test_winreg
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file28883/test_winreg.diff

___
Python tracker 

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



[issue17064] Fix sporadic buildbot failures for test_mailbox

2013-01-28 Thread Jeremy Kloth

New submission from Jeremy Kloth:

Attached is an attempt at fixing the sporadic failures of test_mailbox on the 
AMD64 Windows buildbot.

It fails due to access errors on some directories which leads me to believe the 
helper functions in test.support should fix the problem.

--
components: Tests
files: test_mailbox.diff
keywords: patch
messages: 180862
nosy: jkloth
priority: normal
severity: normal
status: open
title: Fix sporadic buildbot failures for test_mailbox
versions: Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file28882/test_mailbox.diff

___
Python tracker 

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



[issue17049] calendar throws UnicodeEncodeError when locale is specified

2013-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +JJeffries, Retro, christian.heimes, eric.araujo, georg.brandl, haypo, 
ixokai, psam, r.david.murray, tim.golden, twouters

___
Python tracker 

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



[issue13539] Return value missing in calendar.TimeEncoding.__enter__

2013-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> duplicate
stage: test needed -> committed/rejected
status: open -> closed
superseder:  -> calendar throws UnicodeEncodeError when locale is specified

___
Python tracker 

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



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2013-01-28 Thread Éric Araujo

Éric Araujo added the comment:

2.7.3 broke some setup scripts, it wouldn’t be bad to fix this in 2.7.4.  I’ll 
make time before RC.

--

___
Python tracker 

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



[issue16968] Fix test discovery for test_concurrent_futures.py

2013-01-28 Thread Zachary Ware

Zachary Ware added the comment:

Thank you, Chris.  I'm rather ashamed of how long I've spent beating my head on 
this issue and missed the spare tests reference in runtest_inner.

Simply removing the "tests" name entirely clears things up, if this isn't too 
ugly:

diff -r 5f655369ef06 Lib/test/regrtest.py
--- a/Lib/test/regrtest.py  Mon Jan 28 13:27:02 2013 +0200
+++ b/Lib/test/regrtest.py  Mon Jan 28 08:50:59 2013 -0600
@@ -1275,8 +1275,8 @@
 # tests.  If not, use normal unittest test loading.
 test_runner = getattr(the_module, "test_main", None)
 if test_runner is None:
-tests = unittest.TestLoader().loadTestsFromModule(the_module)
-test_runner = lambda: support.run_unittest(tests)
+test_runner = lambda: support.run_unittest(
+unittest.TestLoader().loadTestsFromModule(the_module))
 test_runner()
 if huntrleaks:
 refleak = dash_R(the_module, test, test_runner,

As far as the reap_threads wrapper and reap_children follow-up, I think the 
TestSuite subclass and load_tests function in the last patch I uploaded may be 
about the simplest way to keep them for this test without adding them to all 
tests (by adding it to regrtest.runtest_inner).  If anyone thinks the 
'ReapedSuite' class (or a better named copy) could be useful elsewhere, it 
might could go in test.support which would make test_concurrent_futures look a 
little cleaner.

Patch v3 is v2 plus the regrtest change inline above.

--
Added file: 
http://bugs.python.org/file28881/test_concurrent_futures_discovery.v3.diff

___
Python tracker 

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



[issue17037] Use a test.support helper to wrap the PEP 399 boilerplate

2013-01-28 Thread Brett Cannon

Brett Cannon added the comment:

True, the current idiom needs to still be used in those cases, although we 
could introduce another method to help with this situation as well:

# Could also be named use_accelerator to be less hostile-sounding.
def requires_accelerator(self, cls):
  if self.accelerated_module is None:
raise SkipTest  # With proper message
  else:
setattr(cls, self.module_name, self.accelerated_module)
return cls

Then the idiom becomes:

  @pep399_tests.requires_accelerator
  class AcceleratorSpecificTests(unittest.TestCase): pass


This then extends out to also the current idiom if you don't want to have any 
"magical" classes:

  @pep399_tests.requires_accelerator
  class AcceleratedExampleTests(unittest.TestCase): pass

  # Can add another decorator for this if desired.
  class PyExampleTests(unittest.TestCase):
module = pep399_tests.py_module


This also has the benefit of extracting out the module attribute name to 
minimize messing even that up.

--

___
Python tracker 

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



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2013-01-28 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Does this still need to block 2.7.4?

--

___
Python tracker 

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



[issue16979] Broken error handling in codecs.unicode_escape_decode()

2013-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ezio, is it a good factorization?

def check(self, coder):
def checker(input, expect):
self.assertEqual(coder(input), (expect, len(input)))
return checker

def test_escape_decode(self):
decode = codecs.unicode_escape_decode
check = self.check(decode)
check(b"[\\\n]", "[]")
check(br'[\"]', '["]')
check(br"[\']", "[']")
# other 20 checks ...

And same for test_escape_encode and for bytes escape decoder.

--

___
Python tracker 

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



[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-01-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ah, well... I agree mock.ANY sounds cool :-)
Perhaps it could be mentioned in the docs for assert_etc.? Otherwise you only 
learn about it if you are masochistic enough to read the doc till the end :-)

> you can pull the arguments out for individual assertions using
> some_mock.call_args.

Yeah, but it's cumbersome and it boils down to doing the matching by hand, 
while assert_called_something already does it.

--

___
Python tracker 

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



[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-01-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I'm noticing that with multiple ANY keyword arguments, the order in the result 
tuple is undefined. So perhaps ANY could be instantiable in those cases where 
disambiguation is required:

foo, bar = my_mock.assert_called_with(1, foo=ANY(0), bar=ANY(1))
self.assertIsInstance(bar, someobj)
self.assertIsInstance(foo, someotherobj)

--

___
Python tracker 

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



[issue16335] Integer overflow in unicode-escape decoder

2013-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> closed

___
Python tracker 

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



[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-01-28 Thread Michael Foord

Michael Foord added the comment:

Oh, you want the assert_called_with call to *return* the objects compared with 
the placeholder? 

Well, mock.ANY already exists and you can pull the arguments out for individual 
assertions using some_mock.call_args.

args, kwargs = some_mock.call_args

--

___
Python tracker 

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



[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-01-28 Thread Michael Foord

Michael Foord added the comment:

You mean like mock.ANY ?

--

___
Python tracker 

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



[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-01-28 Thread Antoine Pitrou

New submission from Antoine Pitrou:

assert_called_with currently compares every argument for equality, which is not 
very practical when one of the arguments is a complex object, of which you only 
want to check certain properties.

It could be very nice if you could write e.g.:

from mock import Mock, PLACEHOLDER

...
my_mock(1, someobj(), bar=someotherobj()):
foo, bar = my_mock.assert_called_with(
1, PLACEHOLDER, bar=PLACEHOLDER)
self.assertIsInstance(bar, someobj)
self.assertIsInstance(foo, someotherobj)


(another name for PLACEHOLDER could be CAPTURE, regex-style :-))

--
messages: 180852
nosy: michael.foord, pitrou
priority: normal
severity: normal
status: open
title: assert_called_with could be more powerful if it allowed placeholders
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue15933] flaky test in test_datetime

2013-01-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue5289] ctypes.util.find_library does not work under Solaris

2013-01-28 Thread Trent Nelson

Changes by Trent Nelson :


--
nosy: +trent

___
Python tracker 

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



[issue17052] unittest discovery should use self.testLoader

2013-01-28 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I will at least! :)  I noticed the issue after trying to use unittest test 
discovery with a custom loader.  Fortunately, there is at least this 
work-around (though it relies on an implementation detail):

class MyTestProgram(unittest.TestProgram):

# Override because of issue #17052.
def _do_discovery(self, argv, Loader=None):
if Loader is None:
Loader = lambda: self.testLoader
super(TestPizza, self)._do_discovery(argv, Loader=Loader)

--

___
Python tracker 

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



[issue17062] An os.walk inspired replacement for pkgutil.walk_packages

2013-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
type:  -> enhancement

___
Python tracker 

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



[issue12520] spurious output in test_warnings

2013-01-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
versions: +Python 3.4

___
Python tracker 

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



[issue17052] unittest discovery should use self.testLoader

2013-01-28 Thread Michael Foord

Michael Foord added the comment:

I think you're correct - although I wonder if *anyone*, *ever* will be helped 
by the change. :-)

--

___
Python tracker 

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



[issue14302] Rename Scripts directory to bin and move python.exe to bin

2013-01-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue17062] An os.walk inspired replacement for pkgutil.walk_packages

2013-01-28 Thread Nick Coghlan

Nick Coghlan added the comment:

Regarding the PEP comment - the piece that would be missing is the 
"iter_modules" functionality. Currently pkgutil provides the support for 
standard filesystem imports and zipimports directly - the generic function 
based extension mechanism is undocumented.

--

___
Python tracker 

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



[issue17062] An os.walk inspired replacement for pkgutil.walk_packages

2013-01-28 Thread Nick Coghlan

Nick Coghlan added the comment:

Oops, forgot the proposed call signature:

def walk_path(path=None, *, pkg=None):
"""Walk a package hierarchy, starting with the given path

Iterator producing (package, subpackages, submodules) triples.
The first entry is the package currently being walked, or None
for the top level path. The subpackages and submodules entries
are dictionaries mapping from fully qualified module names to
the appropriate module loaders.

Entries may be removed from the subpackages dictionary to avoid
loading those packages and recursing into them.

If both pkg and path are None, walks sys.path

If path is not None, walks the specified path.

If pkg is not None, walks pkg.__path__

Providing both path and pkg results in ValueError
"""

--

___
Python tracker 

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



[issue17062] An os.walk inspired replacement for pkgutil.walk_packages

2013-01-28 Thread Nick Coghlan

New submission from Nick Coghlan:

I recently had occasion to use pkgutil.walk_packages, and my immediate thought 
was that it would have been a lot easier for me to use if it worked more like 
os.walk with topdown=True, producing tuples of (pkg, subpackages, modules)

"pkg" would be the package object at the current level (None for the top level)

"packages" would be a dictionary mapping fully qualified module names to loader 
objects for the subpackages (i.e. subdirectories)

"modules" would be a dictionary mapping fully qualified module names to loader 
objects for every submodule that wasn't a subpackage

As with editing the "subdirs" list with os.walk, editing the "packages" 
dictionary with this new API would keep the iterator from loading that 
subpackage and avoid recursing into it (this is the part I wanted in my current 
use case).

(This may even be PEP material, guiding some additions to the importer/finder 
API)

--
components: Library (Lib)
messages: 180847
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: An os.walk inspired replacement for pkgutil.walk_packages
versions: Python 3.4

___
Python tracker 

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



[issue17061] tokenize unconditionally emits NL after comment lines & blank lines

2013-01-28 Thread Thomas Kluyver

New submission from Thomas Kluyver:

The docs describe the NL token as "Token value used to indicate a 
non-terminating newline. The NEWLINE token indicates the end of a logical line 
of Python code; NL tokens are generated when a logical line of code is 
continued over multiple physical lines."

However, after a comment or a blank line, tokenize emits NL, even when it's not 
inside a multi-line statement. For example:

In [15]: for tok in tokenize.generate_tokens(StringIO('#comment\n').readline):  
print(tok)
TokenInfo(type=54 (COMMENT), string='#comment', start=(1, 0), end=(1, 8), 
line='#comment\n')
TokenInfo(type=55 (NL), string='\n', start=(1, 8), end=(1, 9), 
line='#comment\n')
TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0), end=(2, 0), line='')

This makes it difficult to use tokenize to detect multi-line statements, as we 
want to do in IPython.

In my tests so far, changing two instances of NL to NEWLINE in this block 
(lines 530 & 533) makes it behave as I expect:
http://hg.python.org/cpython/file/a375c3d88c7e/Lib/tokenize.py#l524

--
messages: 180846
nosy: takluyver
priority: normal
severity: normal
status: open
title: tokenize unconditionally emits NL after comment lines & blank lines
versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue7358] cStringIO not 64-bit safe

2013-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch.

--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file28880/cStringIO64.patch

___
Python tracker 

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



[issue12691] tokenize.untokenize is broken

2013-01-28 Thread Thomas Kluyver

Thomas Kluyver added the comment:

Is there anything I can do to push this forwards? I'm trying to use tokenize 
and untokenize in IPython, and for now I'm going to have to maintain our own 
copies of it (for Python 2 and 3), because I keep running into problems with 
the standard library module.

--
nosy: +takluyver

___
Python tracker 

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



[issue13590] extension module builds fail with python.org OS X installers on OS X 10.7 and 10.6 with Xcode 4.2

2013-01-28 Thread Ned Deily

Changes by Ned Deily :


Added file: http://bugs.python.org/file28879/issue13590_backport_32.patch

___
Python tracker 

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



[issue13590] extension module builds fail with python.org OS X installers on OS X 10.7 and 10.6 with Xcode 4.2

2013-01-28 Thread Ned Deily

Ned Deily added the comment:

Attached are the back ports to 2.7.x and 3.2.x of the Xcode 4 support changes 
as released in 3.3.0.  I've built and tested both with various configurations 
on a variety of systems, both Intel and PPC, and various OS X versions (10.4, 
10.5, 10.6, 10.7, and 10.8), including all of the standard installer 
configurations.  I also tested with just the standalone Command Line Tools 
package (for 10.7 and 10.8).  With these back ports, extension module builds 
should once again work out of the box on all supported systems with their most 
recent versions of Xcode or Command Line Tools.  Unless there are objections, 
I'll commit these in the next day or two for 2.7.4 and 3.2.4.

--
stage: needs patch -> commit review
Added file: http://bugs.python.org/file28878/issue13590_backport_27.patch

___
Python tracker 

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



[issue17059] tarfile.is_tarfile without read permissions raises AttributeError

2013-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for the report, Damian. This was fixed in issue11513.

--
assignee:  -> serhiy.storchaka
components: +Library (Lib) -None
nosy: +serhiy.storchaka
resolution:  -> out of date
stage:  -> 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



[issue17060] IDLE -- jump to home should not go past the PS1 and PS2 prompts

2013-01-28 Thread Raymond Hettinger

New submission from Raymond Hettinger:

In IDLE's shell, pressing  or  currently jumps to the 
beginning of a line.   Instead it should stop *after* the ">>> "  prompt.

--
components: IDLE
messages: 180841
nosy: rhettinger
priority: normal
severity: normal
status: open
title: IDLE -- jump to home should not go past the PS1 and PS2 prompts
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue7358] cStringIO not 64-bit safe

2013-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
components: +Extension Modules, IO -Library (Lib)
nosy: +serhiy.storchaka
stage:  -> needs patch
versions:  -Python 2.6

___
Python tracker 

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



[issue13555] cPickle MemoryError when loading large file (while pickle works)

2013-01-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +cStringIO not 64-bit safe -cStringIO.StringIO aborted when more 
then INT_MAX bytes written

___
Python tracker 

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



[issue17054] cStringIO.StringIO aborted when more then INT_MAX bytes written

2013-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Indeed.

--
resolution:  -> duplicate
stage: needs patch -> committed/rejected
status: open -> closed
superseder:  -> cStringIO not 64-bit safe

___
Python tracker 

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



[issue16997] subtests

2013-01-28 Thread Nick Coghlan

Nick Coghlan added the comment:

Right, if you want independently addressable/runnable, then you're back to 
parameterised tests as discussed in issue7897.

What I like about Antoine's subtest idea is that I think it can be used to 
split the execution/reporting part of parameterised testing from the 
addressing/selection part.

That is, while *this* patch doesn't make subtests addressable, a future 
enhancement or third party test runner could likely do so. (It wouldn't work 
with arbitrary subtests, it would only be for data driven variants like those 
described in issue7897)

--

___
Python tracker 

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



[issue15273] Remove unnecessarily random behavior from test_unparse.py

2013-01-28 Thread Daniel Cioata

Daniel Cioata added the comment:

a solution for this issue

--
nosy: +Daniel.Cioata
Added file: http://bugs.python.org/file28877/submitted_patch_Issue15273

___
Python tracker 

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