New submission from
Robert Collins
:
Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type help, copyright, credits or license for more information.
'asd'.find('s', None, None
Robert Collins added the comment:
The error message is wrong: it's a TypeError, but the message should say
something like...
TypeError: slice indices must be integers or have an __index__ method
This would be a false message, as, as my report demonstrated, slice
indices *can* be None
Changes by Robert Collins robe...@robertcollins.net:
--
keywords: +patch
Added file: http://bugs.python.org/file19624/rusage-thread.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10440
Robert Collins robe...@robertcollins.net added the comment:
Its a common convention in zope.testing, trial, testtools, bzr, ...
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7501
New submission from Robert Collins robe...@robertcollins.net:
There is a systemic bug in BZ2File where the GIL is released to perform
compression work, and any other thread calling into BZ2File will
deadlock. We noticed in the write method, but inspection of the code
makes it clear that its
Robert Collins robe...@robertcollins.net added the comment:
On Sun, 2009-10-25 at 22:00 +, Antoine Pitrou wrote:
Antoine Pitrou pit...@free.fr added the comment:
Thanks, nice catch.
Yeah :).
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2
Python 2.5 is also affected - its
Robert Collins robe...@robertcollins.net added the comment:
On Sun, 2009-10-25 at 22:27 +, Antoine Pitrou wrote:
Antoine Pitrou pit...@free.fr added the comment:
Python 2.5 is also affected - its what we're running on the server that
broke :)
Yes, but it doesn't receive any bug
Robert Collins robe...@robertcollins.net added the comment:
On Mon, 2009-10-26 at 19:23 +, Antoine Pitrou wrote:
Antoine Pitrou pit...@free.fr added the comment:
Here is a patch.
Looks fine to me assuming that the locking functions can be used outside
the GIL.
On the test side
Robert Collins robe...@robertcollins.net added the comment:
On Mon, 2009-10-26 at 21:27 +, Antoine Pitrou wrote:
Antoine Pitrou pit...@free.fr added the comment:
Well, your test case often succeeded here, so I decided on a more
aggressive variation.
fair enough, if its needed - its
Robert Collins robe...@robertcollins.net added the comment:
Ran into this trying to do some test isolation stuff.
Notwithstanding the questions about 'why', this is a clear limitation
hat can be solved quite simply - is there any harm that will occur if we
fix it?
I've attached a patch
Robert Collins robe...@robertcollins.net added the comment:
This affects 2.7 too.
--
versions: +Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1515
Robert Collins robe...@robertcollins.net added the comment:
@Antoine, I agree that the tests for copy should be a proper unit test;
that seems orthogonal to this patch though :)
I don't have a checkout of 3 at the moment, but do you think the test
failure on 3 is shallow or deep
Robert Collins robe...@robertcollins.net added the comment:
Oh man, I looked for a regular unit test - sorry that I missed it. Bah.
I've added a call to the method and moved it into test_copy.
--
Added file: http://bugs.python.org/file15406/issue1515.patch
New submission from Robert Collins robe...@robertcollins.net:
With deepcopy fixed, I ran across this little fixable component.
--
components: Library (Lib)
files: deepcopy-works.patch
keywords: patch
messages: 95823
nosy: rbcollins
severity: normal
status: open
title: cleanup now
New submission from Robert Collins robe...@robertcollins.net:
from copy import deepcopy
from itertools import count
c = count()
c.next()
0
deepcopy(c)
count(0)
c.next()
1
deepcopy(c)
count(0)
c
count(2)
deepcopy(c).next()
0
I don't see any reason why these shouldn't be deepcopyable
Changes by Robert Collins robe...@robertcollins.net:
--
nosy: +rbcollins
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2422
___
___
Python-bugs
Robert Collins robe...@robertcollins.net added the comment:
2) 0 args, e = MyException(), with overridden __str__:
py2.5 : str(e) - 'ascii' or error; unicode(e) - u'ascii' or error;
py2.6 : str(e) - 'ascii' or error; unicode(e) - u''
desired: str(e) - 'ascii' or error; unicode(e
New submission from Robert Collins robe...@robertcollins.net:
:!python -m unittest foo.test_suite
Traceback (most recent call last):
File /usr/lib/python2.6/runpy.py, line 122, in _run_module_as_main
__main__, fname, loader, pkg_name)
File /usr/lib/python2.6/runpy.py, line 34
New submission from Robert Collins robe...@robertcollins.net:
Say I have a test module test_foo, which fails to import with
ImportError. A reason for this might be a misspelt import in that module.
TestLoader().loadTestsFromName swallows the import error and instead
crashes with:
File /usr
Robert Collins robe...@robertcollins.net added the comment:
mkdir thing
touch thing/__init__.py
echo import blert thing/test_foo.py
python -m unittest thing.test_fooTraceback (most recent call last):
File /usr/lib/python2.6/runpy.py, line 122, in _run_module_as_main
__main__, fname
Robert Collins robe...@robertcollins.net added the comment:
I'm scratching an itch at the moment, I just noted this in passing ;)
I'm partial to the 'turn it into a fake test case' approach, its what I
would do if I get to it first.
--
___
Python
New submission from Robert Collins robe...@robertcollins.net:
This affects the python implementation of RLock only.
If a signal occurs during RLock.acquire() or release() and then operates on the
same lock to acquire() or release() it, process hangs or assertions can be
triggered
Robert Collins robe...@robertcollins.net added the comment:
I'm not sure it is sensibly implementable in pure python: the semantics of
signal handling (AIUI) are that the vm is interrupted, sets a flag to say 'when
the GIL is released or the next bytecode interpretation happens, please process
Robert Collins robe...@robertcollins.net added the comment:
Normally I advocate very strongly for Python implementation of C accelerated
modules, but when the two implementations are not equivalent, having a simpler
Python one around does not help anyone (not users, other language implementors
New submission from Robert Collins:
In loader.py:
if fnmatch(path, pattern):
# only check load_tests if the package directory itself
matches the filter
name = self._get_name_from_path(full_path)
package = self
Robert Collins added the comment:
BTW I'm very happy with testscenarios (on pypi) for this, modulo one small
issue which is the use of __str__ by the stdlib [which isn't easily overridable
- there is a separate issue on that]. I'd be delighted to have testscenarios be
in the stdlib, if thats
Robert Collins added the comment:
I have a package with tests in it. If the tests match test*.py, they are
loaded, and load_tests within each one called. But load_tests on the package
isn't called.
If I change the pattern supplied by the user to match the package, then the
tests within
New submission from Robert Collins:
Openstack recently switched from nose to using discover. discover walks the
filesystem using os.listdir(), and that is just a thin layer over readdir. On
ext3/ext4 filesystems, readdir is in an arbitrary order dependent on file
insertion into the directory
New submission from Robert Collins:
the docs (http://docs.python.org/3.x/library/io.html#io.FileIO) do not document
closefd, and AFAICT it isn't possible to tell if closefd is set after the
object is created. Specifically it does not show up in the repr().
import sys
sys.stdout
New submission from Robert Collins:
The io library rejects unbuffered text I/O, but this is not documented - and in
fact can be manually worked around:
binstdout = io.open(sys.stdout.fileno(), 'wt', 0)
sys.stdout = io.TextIOWrapper(binstdout, encoding=sys.stdout.encoding)
will get
Robert Collins added the comment:
Huh, I didn't realise idna would retain data! But that will still be within the
TextIOWrapper itself, right?
And a stream opened 'wt' cannot be read from anyway, so the read1 limitation is
irrelevant
Changes by Robert Collins robe...@robertcollins.net:
--
nosy: +rbcollins
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18526
___
___
Python-bugs
Robert Collins added the comment:
I'll do a full review shortly, but at the conceptual level, I don't see any
benefit in making a new SkipTest base class, other than instantly breaking
other runners when an unknown exception is raised. SkipTest is part of the API.
Making a new exception part
Robert Collins added the comment:
Hey, feel free to +nosy me on unittest things :). Julian pinged me on IRC about
this - Jml and I would be delight to prepare a patchset for assertThat for
unittest and as much of the core of Matchers as makes sense. The bare core can
come in without any
Robert Collins added the comment:
This is a duplicate of 16662
--
nosy: +rbcollins
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18198
Robert Collins added the comment:
Well, spoke with vila on IRC. I content it's a duplicate because if load_tests
in __init__ kicks in and supercedes discovery, I believe this bug would not be
needed.
--
___
Python tracker rep...@bugs.python.org
New submission from Robert Collins:
In bug https://bugs.launchpad.net/subunit/+bug/586176 I recorded a user request
- that if no tests are found, tools consuming subunit streams should be able to
consider that an error.
There is an analogous situation though, which is that if discover returns
New submission from Robert Collins:
In 2.6 deepcopy(ConfigParser) worked, in 2.7 it doesn't due to the _optcre
variable which is a compiled regex pattern.
--
components: Library (Lib)
messages: 171364
nosy: rbcollins
priority: normal
severity: normal
status: open
title: ConfigParser
New submission from Robert Collins:
TextTestRunner calls str(TestCase) directly, which makes it hard for
testscenarios to rename the test cases as it parameterises them (because
__str__ is a descriptor). While testscenarios could use a decorator instead,
thats undesirable as the test case
Robert Collins added the comment:
Or anther way this could be done would be to make TestCase.__str__ call
self.id(), and then __str__ never needs to be adjusted - id() or
shortDescription are the only things to tweak.
--
___
Python tracker rep
Robert Collins added the comment:
They aren't descriptors? They certainly aren't normal methods:
class foo(object):
... def __str__(self): return foo
...
f = foo()
f.__str__ = lambda: bar
str(f)
'foo'
I *thought* the mechanism by which they can only be replaced by altering the
class
Robert Collins added the comment:
testscenarios copies the tests, it doesn't call the constructor for the class;
this makes things a lot simpler than trying to reconstruct whatever state the
object may have from scratch again.
As for str(test) and test.id() being different - well sure
Robert Collins added the comment:
@Michael I'll put a patch together next week then.
@R.david.murray no idea - but I've refreshed the page, we'll if it behaves
better. My guess would be a buggy in-flight-collision detection in the issue
tracker code
Robert Collins robe...@robertcollins.net added the comment:
It should run after tearDown so that teardown can do actions that may
require cleanup; because the cleanups run in LIFO you can acquire
resources in setUp and have cleanups clean them up,
--
nosy: +rbcollins
Robert Collins robe...@robertcollins.net added the comment:
Actually let me phrase that differently.
standard practice for setUp is
super.setUp()
my_setup_code()
and tearDown is
my_teardown_code()
super.tearDown()
because of the LIFO need.
If you imagine that clean ups are being done
New submission from Robert Collins robe...@robertcollins.net:
Currently if you alter the way TestSuite iterates one must always
implement countTestCases, run, debug etc. The attached patch would make
this simpler.
If this looks ok I'll write up a test for it.
--
components: Library
Robert Collins robe...@robertcollins.net added the comment:
On Sat, 2009-04-04 at 22:09 +, Antoine Pitrou wrote:
Antoine Pitrou pit...@free.fr added the comment:
teardown
Why should they? It's only an implementation choice, and not a wise one
I would say (precisely because people
Robert Collins robe...@robertcollins.net added the comment:
On Sat, 2009-04-04 at 23:06 +, Antoine Pitrou wrote:
Antoine Pitrou pit...@free.fr added the comment:
The main use case for addCleanup is resource allocation in tests. Why
does this require clean ups to be executed before
Robert Collins robe...@robertcollins.net added the comment:
On Sun, 2009-04-05 at 07:25 +, Garrett Cooper wrote:
Garrett Cooper yaneg...@gmail.com added the comment:
I think some perspective is required on this enhancement request. I
originally filed this issue -- http://bugs.python.org
Robert Collins robe...@robertcollins.net added the comment:
On Sun, 2009-04-05 at 10:15 +, Antoine Pitrou wrote:
Antoine Pitrou pit...@free.fr added the comment:
Our experience in bzr (we use this heavily, and migrated to it
incrementally across our 17K fixture suite) is that we
Robert Collins robe...@robertcollins.net added the comment:
On Sun, 2009-04-05 at 21:31 +, Antoine Pitrou wrote:
Antoine Pitrou pit...@free.fr added the comment:
So, we are talking about adding a feature that could cause problem whether
cleanup is performed before tearDown or after
Robert Collins robe...@robertcollins.net added the comment:
On Sun, 2009-04-05 at 23:49 +, Michael Foord wrote:
As an interesting data point, the Bzr code does clean ups *before*
tearDown.
No it doesn't:
We subclass unittest.TestCase. We also override run() to make tearDown
run
Robert Collins robe...@robertcollins.net added the comment:
On Sun, 2009-04-05 at 23:57 +, Michael Foord wrote:
Michael Foord mich...@voidspace.org.uk added the comment:
My apologies - the jml code on launchpad runs clean ups before taerDown.
http://bazaar.launchpad.net/~jml/testtools
New submission from Robert Collins robe...@robertcollins.net:
Original mail:
JML's testtools has a TestResult subclass with a done() method. The
reason for this method is to allow doing things after the last test has
run. While a result can infer 'first test' it can't infer 'last test'
without
Robert Collins robe...@robertcollins.net added the comment:
Now, some refinements, as usual (for me at least) when considering a
feature like this from an upstream perspective, where one's immediate
use cases are just special cases not general case, I've come up with
some refinements.
Firstly
Robert Collins robe...@robertcollins.net added the comment:
I've written up a patch for this; it works with old result classes too.
Hopefully the bugtracker will attach it in reply to this mail; if not
I'll put in via the webui this evening.
-Rob
--
keywords: +patch
Added file: http
Robert Collins robe...@robertcollins.net added the comment:
On Wed, 2009-04-15 at 23:19 +, Barry A. Warsaw wrote:
Barry A. Warsaw ba...@python.org added the comment:
The patch looks fine to me, except that it's missing documentation
updates. The feature and names are fine too.
Where
Robert Collins robe...@robertcollins.net added the comment:
Updates - docs, and fixes a couple of stubbed out upcalls in the logging
result put in while bootsrapping.
--
Added file: http://bugs.python.org/file13709/start-stop-TestRun.patch
___
Python
Robert Collins robe...@robertcollins.net added the comment:
On Sat, 2009-04-25 at 23:17 +, Michael Foord wrote:
Michael Foord mich...@voidspace.org.uk added the comment:
Proper patch and proper issue this time! Not my evening.
--
Added file: http://bugs.python.org/file13787
Robert Collins robe...@robertcollins.net added the comment:
Maybe I'm missing something, but isn't the offset parameter just another
way of spelling
buffer(input, offset)?
I like the avoiding of copying, just wondering if having a magic
parameter to get a tuple is really better than (say
Robert Collins robe...@robertcollins.net added the comment:
Well, I think its relatively uncommon to be doing such a loop with a
static buffer anyway - often you'll instead be reading from disk or a
network stream; if we could make those cases simpler and avoid copying
that would be great
New submission from Robert Collins:
https://bugs.launchpad.net/testtools/+bug/1245672 was filed on testtools
recently. It would be easier to fix that if there was some way that something
loading a test suite could check to see if there were import errors. The
current code nicely works
Robert Collins added the comment:
I concur that this is a regression -
unittest.expectedFailure()
Mark the test as an expected failure. If the test fails when run, the test
is not counted as a failure.
is in the public docs for the unittest module, and depending on a private
Robert Collins added the comment:
Oh! I didn't realise it was due to us looking at a private exception - I
haven't been given a traceback to review, just the statement of a problem
We shouldn't have done that(and *Definitely* should have filed a bug that we
needed to).
So - I think
Robert Collins added the comment:
I think we rather need a test that using a load_tests hook to recursively load
and transform a subdir works. Hacking on that now.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
Robert Collins added the comment:
Ok, implementation I'm happy with is up in
https://bitbucket.org/rbtcollins/cpython/commits/bbf2eb26dda8f3538893bf3dc33154089f37f99d
--
hgrepos: +269
Added file: http://bugs.python.org/file36482/16662_passing_tests.diff
Robert Collins added the comment:
The doc part of the patch was assuming this would be in 3.4 which it wasn't.
Updated to 3.5. Also found a corner case - when packages were imported the
_get_module_from_name method was not guarded for un-importable modules. This is
strictly a separate issue
Robert Collins added the comment:
Thanks for landing this barry, there's a couple quirks with your improvements -
loadTestsFromModule(mod, foo, bar) will raise a TypeError but not warn about
foo the way loadTestsFromModule(mod, foo) will.
Secondly, the TypeError has an off-by-one error in its
Robert Collins added the comment:
OH! One more thing I just spotted, which is that this change causes
non-'discover' unittest test loading to invoke load_tests.
IMO this is the Right Thing - its what I intended when I described the protocol
a few years back, but we should document
Robert Collins added the comment:
Its more than just a docs issue - AFAICT it isn't possible to tell if closefd
is set after the object is created.
The presence of the parameter in the signature is there, but it isn't
documented *where the bulk of the FileIO parameters are* - there are docs
Robert Collins added the comment:
Oh - the the 'open' function docs are fine - they are just a pointer. I was
specifically referring to the class docs around line 513 of Doc/library/io.rst.
Attached is a patch that changes repr to show this attribute and extends the
docs to document
Robert Collins added the comment:
@michael - ah I think I inverted the sense of the old parameter. It was
defaulting True. So - no need to document anything extra:)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
Robert Collins added the comment:
Here is an implementation. I'm probably missing some finesse in the docs.
--
keywords: +patch
Added file: http://bugs.python.org/file36577/issue19746.patch
___
Python tracker rep...@bugs.python.org
http
Robert Collins added the comment:
I've just put a patch up for the related issue http://bugs.python.org/issue19746
I'll poke at this one briefly now, since I'm across the related code.
--
___
Python tracker rep...@bugs.python.org
http
Robert Collins added the comment:
Ok, here is an implementation that I believe covers everything Michael wanted.
I examined the other patches, and can rearrange my implementation to be more
like them if desired - but at the heart of this this bug really has two
requested changes:
- deferred
Robert Collins added the comment:
@Terry in principle you're right, there are an arbitrary number of things that
can go wrong, but in practice what we see is either catastrophic failure where
nothing is loaded at all *and* no error is returned or localised failure where
the deferred reporting
Robert Collins added the comment:
You may need to apply the patch from http://bugs.python.org/issue19746 first as
well - I was testing with both applied.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7559
Robert Collins added the comment:
This is what I see in my tree:
E
==
ERROR: test_os (unittest.loader.ModuleImportFailure)
--
Traceback (most recent call last
Robert Collins added the comment:
Raced with your comment. Great - and thanks!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7559
Robert Collins added the comment:
Thanks; I'm still learning how to get the system here to jump appropriately :).
I thought I'd told hg to reset me to trunk...
You are right about the docs. Reading that, I thought it was saying that
errors would have a list of the errors that show up
New submission from Robert Collins:
python -m unittest discover -t . foo
where foo is a package
will not trigger load_tests in foo/__init__.py.
To reproduce:
mkdir -p demo/tests
cd demo
cat EOF tests/__init__.py
import sys
import os
def load_tests(loader, tests, pattern):
print(HI WE
Robert Collins added the comment:
I can certainly write the reporter glue to work with either a string or a full
reference. Note that the existing late-reporting glue captures the import error
into a string, and then raises an exception containing that string - so what
I've done is consistent
Robert Collins added the comment:
This should fix this issue :)
--
keywords: +patch
Added file: http://bugs.python.org/file36694/issue22457.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22457
Robert Collins added the comment:
I've managed to get a windows setup working. Its my mini-vfs which needs to be
Windows aware (because the abs path of /foo is C:\\foo). I'll work up a patch
tomorrowish.
--
___
Python tracker rep...@bugs.python.org
Robert Collins added the comment:
Fix up the tests patch - tested on windows 7.
--
Added file: http://bugs.python.org/file36713/fix-windows-tests.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
Robert Collins added the comment:
bah, wrong extension to trigger review code :)
--
Added file: http://bugs.python.org/file36714/fix-windows-tests.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
Changes by Robert Collins robe...@robertcollins.net:
Removed file: http://bugs.python.org/file36713/fix-windows-tests.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
New submission from Robert Collins:
The .gitignore file was missing some build products on windows. The attached
patch makes the tree be clean after doing a debug build.
--
files: windows-git-ignore.diff
keywords: patch
messages: 227498
nosy: rbcollins
priority: normal
severity: normal
Robert Collins added the comment:
Updated patch - fixes windows tests for this patch.
--
Added file: http://bugs.python.org/file36716/issue22457.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22457
Robert Collins added the comment:
Right: the existing code stringifies the original exception and creates an
exception object and a closure
def test_thing(self):
raise exception_obj
but that has the stringified original exception.
--
___
Python
Robert Collins added the comment:
So this looks like its going to instantly create bugs in programs that use it.
HTTP/1.1 headers are one of:
latin1
MIME encoded (RFC2047)
invalid and working only by accident
HTTP/2 doesn't change this.
An API that encourages folk to encode into utf8
Robert Collins added the comment:
FWIW we probably need to capture the original unaltered URL somewhere, but also
ensure that PATH_INFO is always a relative path.
One should be able to implement a proxy in WSGI (because thats just another
specialised app), and doing that today requires
Robert Collins added the comment:
Oh, also - while its tempting to say that it doesn't matter whether we take the
urls host portion, or the host header or the server name - it does. Deployments
that look like:
LB/Firewall - backend container - WSGI app
are likely to have assumptions within
Robert Collins added the comment:
So I guess the API concern I have is that there are two cases:
- common spec compliant - US-ASCII + RFC2047
- dealing with exceptions - UTF8 or otherwise
The former totally makes sense as a codec, though the current email
implementation of it isn't quite
Robert Collins added the comment:
FWIW I'd really like to be reducing the TestCase API not extending it -
particularly since there are lots of good convenient ways of doing this already
(not least mock.patch/mock.patch.object).
So I'm -0.5 on adding this, as I don't see it adding value
Robert Collins added the comment:
Closing as the fix to the test suite is applied.
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
New submission from Robert Collins:
cpython.hg$ make patchcheck
./python ./Tools/scripts/patchcheck.py
Getting the list of files that have been added/changed ... 448 files
Fixing whitespace ... 0 files
Fixing C file whitespace ... 5 files:
Include/patchlevel.h
Modules/_ctypes/callbacks.c
Robert Collins added the comment:
FWIW testtools rejects test suites with duplicate test ids; I'm considering
adding that feature into unittest itself. We'd need an option to make it warn
rather than error I think, but if we did that we wouldn't need a separate
script at all.
--
nosy
Changes by Robert Collins robe...@robertcollins.net:
Removed file: http://bugs.python.org/file36716/issue22457.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22457
Robert Collins added the comment:
Updated patch.
--
Added file: http://bugs.python.org/file36973/issue22457.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22457
1 - 100 of 538 matches
Mail list logo