Robert Collins 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 alway
Robert Collins added the comment:
On Sun, 2009-04-05 at 23:57 +, Michael Foord wrote:
> Michael Foord added the comment:
>
> My apologies - the jml code on launchpad runs clean ups before taerDown.
>
> http://bazaar.launchpad.net/~jml/testtools/trunk/annotate/he
New submission from Robert Collins :
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'
Robert Collins 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, I said you
Robert Collins 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://bugs.
Robert Collins added the comment:
On Wed, 2009-04-15 at 23:19 +, Barry A. Warsaw wrote:
> Barry A. Warsaw added the comment:
>
> The patch looks fine to me, except that it's missing documentation
> updates. The feature and names are fine too.
Where do t
Robert Collins 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 tracker
<h
Robert Collins added the comment:
On Sat, 2009-04-25 at 23:17 +, Michael Foord wrote:
> Michael Foord added the comment:
>
> Proper patch and proper issue this time! Not my evening.
>
> --
> Added file: http://bugs.python.org/file13787/unittest-no-exit.patch
D
Robert Collins 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)
re
Robert Collins 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.
Anyhow, no strong opi
Robert Collins added the comment:
A few thoughts;
usedforsecurity=xxx seems awkward: I wouldn't want, as a user of hashlib, to
have to put that in literally every use I make of it.
If I understand the situation correctly, the goal is for both linters, and at
runtime, identification o
Robert Collins added the comment:
@doug - I don't see how a separate fips module *wouldn't* solve it:
- code that uses md5 in security contexts wouldn't be able to call it from the
fips module, which is the needed outcome
- code that uses md5 and isn't fips compliant wou
Robert Collins added the comment:
Thanks for proposing this. I really don't want to add new assertions to
unittest, and I certainly don't want to add narrow usage ones like this, nor
ones that are confusingly named (this has nothing to do with files, but 'close'
is a verb
Robert Collins added the comment:
So its a feature of mock that it can mock a module that doesn't exist. And the
semantics of the import system are designed to be very cheap when a module is
already imported - so when 'patchbug.a' is in sys.modules, import will
correctly return
Robert Collins added the comment:
I'm fine with these as a mixin - they are all very generic and unambiguously
named. I'd marginally prefer the opt-in mixin over adding them to the base
class.
Ideally they'd be matchers, but since I haven't ported that upstream yet, th
Robert Collins added the comment:
Future direction: hamcrest style matchers. You can read more about them in the
context of unittest
https://rbtcollins.wordpress.com/2010/05/10/maintainable-pyunit-test-suites/
and http://testtools.readthedocs.io/en/latest/for-test-authors.html#matchers
Robert Collins added the comment:
There are two related things here.
Firstly, the generator's body will run without the patch (because the wrapping
function has
try:
return decorated(..)
finally:
unpwatch()
Secondly, the wrapping function is itself not a generator, and anything
Robert Collins added the comment:
Once fixed in CPython, we'll put the backport in mock, for folk using older
Python's.
--
versions: -Python 2.7, Python 3.2, Python 3.3, Python 3.4
___
Python tracker
<http://bugs.python.o
Robert Collins added the comment:
Chris, I suggested altering assertAlmostEqual in
http://bugs.python.org/issue27198#msg267187 :) - I took your agreement with
that as a good thing and didn't reply because I had nothing more to add.
IMO the status of this issue is as you indicated: you n
Robert Collins added the comment:
hmm, can you give me a change to page this in? I'm pretty sure I saw breakage
in external libraries prompting me to add the test and fix. I'd rather not
recause that.
--
___
Python tracker
<http://bu
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
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)
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
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 add
Robert Collins added the comment:
Closing as the fix to the test suite is applied.
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/i
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.
Changes by Robert Collins :
Removed file: http://bugs.python.org/file36716/issue22457.diff
___
Python tracker
<http://bugs.python.org/issue22457>
___
___
Python-bug
Robert Collins added the comment:
Updated patch.
--
Added file: http://bugs.python.org/file36973/issue22457.patch
___
Python tracker
<http://bugs.python.org/issue22
Changes by Robert Collins :
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue17401>
___
___
Python-bugs-list
Changes by Robert Collins :
Added file: http://bugs.python.org/file36974/issue7559.patch
___
Python tracker
<http://bugs.python.org/issue7559>
___
___
Python-bugs-list m
Robert Collins added the comment:
Patch polished up and updated - ready for review IMO.
--
___
Python tracker
<http://bugs.python.org/issue7559>
___
___
Python-bug
Robert Collins added the comment:
I think its worth a note that the stdio streams are constructed specially, even
with the repr improvements.
--
nosy: +rbcollins
___
Python tracker
<http://bugs.python.org/issue22
Robert Collins added the comment:
Yeah thats nicer. I'll apply that later unless you can.
--
___
Python tracker
<http://bugs.python.org/issue17401>
___
___
Robert Collins added the comment:
Showing it only when False would have higher cognitive load. Showing it always
is simple and clear.
--
___
Python tracker
<http://bugs.python.org/issue17
Robert Collins added the comment:
A few thoughts.
Adding a new public symbol seems inappropriate here: this is a performance
issue that is well predictable and we should cater for that (given difflibs
current performance).
I'll note in passing that both bzr and hg have much h
Robert Collins added the comment:
Just to note that unittest2 tip (unreleased)had michaels proposed fix, which is
different to that here. I'm going to back that out before doing a release,
because they should be harmonisious.
--
nosy: +rbco
Robert Collins added the comment:
My take on this, FWIW, is that any methods in the under-test API - setUp,
tearDown, test_* and anything registered via addCleanup should all support the
same protocol as much as possible, whatever it is.
That is, raising a skip in setUp should skip the test
Robert Collins added the comment:
I'd argue for
- An error - its not covered by the decorator.
- An error - the last two are not covered by the decorator.
- An error - the last two are not covered by the decorator.
- An error - the exception isn't a 'failure' [today - we
Robert Collins added the comment:
Oh, I got a profile from the test case for my own interest.
6615 seconds ..
some highlights that jumped out at me
200010.1270.000 6610.0250.330 difflib.py:868(compare)
which means we're basically using ndiff, which is cubic rather
Robert Collins added the comment:
Thanks for the review, updated patch here - I'll let this sit for a day or two
for more comments then commit it Monday.
--
Added file: http://bugs.python.org/file37002/issue7559.patch
___
Python tracker
Robert Collins added the comment:
I've updated the patch to try and address the niggling clarity issues from the
review. Please let me know what you think (and if I hear nothing I'll commit it
as-is since the review was still ok).
--
Added file: http://bugs.python.org
Robert Collins added the comment:
assertions in setUp are fine IMO. But here's the thing. WHat should this code
do?
class Demo(unittest.TestCase):
def setUp(self):
raise Exception('hi')
def test_normal(self):
# this should NOT be covered by
Robert Collins added the comment:
runTest is part of the current API. I think if we're going to hide it we should
do so as part of a deprecation path. (I'm +1 on hiding it).
--
___
Python tracker
<http://bugs.python.o
Changes by Robert Collins :
--
nosy: +rbcollins
___
Python tracker
<http://bugs.python.org/issue21820>
___
___
Python-bugs-list mailing list
Unsubscribe:
Robert Collins added the comment:
Constructing test case objects directly is part of the protocol, and its needed
for framework and extension authors.
I've seen folk use runTest, but rarely enough that I think we could deprecate
it. My argument is that while its supported we should be
New submission from Robert Collins:
found while backporting unittest fixes.
The current test fails like so:
==
FAIL: testAssertEqualSingleLine (unittest2.test.test_case.Test_TestCase
Robert Collins added the comment:
There's comments in the test above about 'not testing ourself with ourselves' -
but we're testing the rendering of an error case, so its entirely legitimate to
use the same method's succe
Changes by Robert Collins :
--
keywords: +patch
Added file: http://bugs.python.org/file37057/issue22756.patch
___
Python tracker
<http://bugs.python.org/issue22
Robert Collins added the comment:
Oh, one thought - in testtools we split out 'docs for test writers' and 'docs
for framework folk'. That would facilitate getting runTest out of test writers
face while still documenting it appropriately.
Related to that is my ongoi
Changes by Robert Collins :
--
title: There is no standard TestCase.runTest implementation -> Documentation of
TestCase.runTest is incorrect and confusing
___
Python tracker
<http://bugs.python.org/issu
New submission from Robert Collins:
The following trivial chain-into-discover load_tests:
def load_tests(loader, tests, pattern):
import os.path
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
return loader.discover(start_dir=this_dir, pattern
Robert Collins added the comment:
Updated patch, after other recent conflicting changes.
--
Added file: http://bugs.python.org/file37071/issue22457.patch
___
Python tracker
<http://bugs.python.org/issue22
Changes by Robert Collins :
--
type: -> behavior
versions: +Python 3.5
___
Python tracker
<http://bugs.python.org/issue22457>
___
___
Python-bugs-list mai
New submission from Robert Collins:
test_assertRaises_frames_survival
(unittest2.test.test_assertions.Test_Assertions
Depends on refcount behaviour to pass - adding a gc.collect() before the
weakref checks is sufficient to fix things on pypy.
test_no_exception_leak (unittest2
Robert Collins added the comment:
Herewith a patch. Applied to unittest2 for backport to unbreak its tests on
pypy.
--
keywords: +patch
Added file: http://bugs.python.org/file37072/issue22764.patch
___
Python tracker
<http://bugs.python.
Changes by Robert Collins :
--
type: -> behavior
___
Python tracker
<http://bugs.python.org/issue22764>
___
___
Python-bugs-list mailing list
Unsubscrib
Robert Collins added the comment:
Hmm? I must have misunderstood the test. Here's my understanding: the test is
testing that a an object ref only held in the traceback object of the exception
is cleaned up such that it can be collected. In a refcount system that
collection is immediate,
Robert Collins added the comment:
I've done some experimentation. Yes, the updated test passes when the
clear_frames call is removed in cPython 3.5
But the original test also passes when clear_frames is not called if one drops
into pdb and steps through, which still fits the sympto
Changes by Robert Collins :
Added file: http://bugs.python.org/file37080/issue22764.patch
___
Python tracker
<http://bugs.python.org/issue22764>
___
___
Python-bugs-list m
Robert Collins added the comment:
I'll apply the patch monday if there are no further comments before then.
--
___
Python tracker
<http://bugs.python.org/is
Robert Collins added the comment:
(Pinging for reviews - I'm going to time out and land this early next week if I
can't get a review on it, since this is actually a fairly significant oversight
and I don't want unittest2 to run ahead of the stdlib - that way leads
unmaint
Changes by Robert Collins :
Added file: http://bugs.python.org/file37118/issue22457.patch
___
Python tracker
<http://bugs.python.org/issue22457>
___
___
Python-bugs-list m
New submission from Robert Collins:
I did a brownbag fix for my change to issue22457 which exposed a untested
corner case - this issue is for me to come back and add a regression test for
it.
--
messages: 230628
nosy: rbcollins
priority: normal
severity: normal
status: open
title
Robert Collins added the comment:
This was reported as https://code.google.com/p/unittest-ext/issues/detail?id=71
a while back. I think blacklisting FunctionTestCase in TestLoader is entirely
reasonable.
--
___
Python tracker
<h
Robert Collins added the comment:
Its backported in unittest2 0.8.0 which is available on pypi for 2.6+ and 3.2+.
The changes are large enough that I'd hesitate to backport them in cPython
itself.
--
___
Python tracker
<http://bugs.py
New submission from Robert Collins:
TestProgram uses defaultTestLoader to load tests. Calling discover() on a
TestLoader sets _top_level_dir. Calling discover with no top_level_dir
implictly sets _top_level_dir but only the first time: the second time it is
called with a different start_dir
Changes by Robert Collins :
--
components: +Library (Lib)
versions: +Python 3.5
___
Python tracker
<http://bugs.python.org/issue22811>
___
___
Python-bugs-list m
Robert Collins added the comment:
https://code.google.com/p/unittest-ext/issues/detail?id=11
I think that the hamcrest inspired matchers stuff may help make this a reality
too. OTOH if we had a clean patch now for the existing asserts that would be
fine too
New submission from Robert Collins:
>From https://code.google.com/p/unittest-ext/issues/detail?id=13
The following is incorrect on Windows:
python -m unittest discover -p '*.py'
It should be without the single quotes around the .py:
python -m unittest discover -p *.py
New submission from Robert Collins:
Unittest doesn't support a test randomisation feature.
Such a feature should support:
- passing in a seed (to allow reproducing the order for debugging)
- preserving the suite hierarchy, to preserve class and module setUp
performance optimisations
New submission from Robert Collins:
If someone has a TestProgram script - e.g. the unit2 script in unittest2,
loading a module in cwd will fail, because the PYTHONPATH doesn't include '.'.
We might want to consider adding cwd to the PYTHONPATH in TestProgram.
>From https:/
New submission from Robert Collins:
Unexpected successes cause failures, but we don't output details about them at
the end of the run.
>From https://code.google.com/p/unittest-ext/issues/detail?id=22
A complicating factor is that we don't have a backtrace to show - but we may
Robert Collins added the comment:
See also https://code.google.com/p/unittest-ext/issues/detail?id=27
"Sorry, wrong wording of the bug.
I tested this on IronPython 2.6.1 and 2.7.b1. I see the same result as you and
I consider the following wrong or at least misleading:
- [1, Decim
Robert Collins added the comment:
Hmm, so testtools went in a different direction here - the same unification
stuff, but see
https://github.com/testing-cabal/testtools/commit/18bc5741cf277f7a0d601568be6dccacc7b0783c
tl;dr - I think unittest should not prevent this causing the process to exit
Changes by Robert Collins :
--
title: Error in setUp not reported as expectedFailure (unittest) -> document
(lack of) interaction between @expectedException on a test_method and setUp
___
Python tracker
<http://bugs.python.org/issu
Robert Collins added the comment:
I don't consider the console output of unittest to be a stable interface.
Michael - do you?
Things that want to process unittest should be using the API.
--
nosy: +rbcollins
___
Python tracker
Robert Collins added the comment:
I agree. IIRC the windows shell passes the argument as "'*.py'" rather than as
"*.py", so when we glob it we get no files, as no python files end with an
apostrophe.
--
___
Python tr
Robert Collins added the comment:
Hi, I'm glad you're interested in this. I very much want to see a
matcher/hamcrest approach rather than a library of assertions per se - because
match-or-except makes layering things harder.
--
___
Pyth
Robert Collins added the comment:
+1 on a plain function or context manager.
w.r.t. addCleanUp taking a context manager, that could be interesting - perhaps
we'd want a thing where you pass it the context manager, it __enter__'s the
manager and then calls addClean
Robert Collins added the comment:
b)
--
___
Python tracker
<http://bugs.python.org/issue22813>
___
___
Python-bugs-list mailing list
Unsubscribe:
Robert Collins added the comment:
Yes, making customising the output easier is a good thing. One way is to use
e.g. subunit.run (which can work with all unittest versions since 2.6) and
write a custom filter. Or a custom TestResult and TextTestRunner can work too
New submission from Robert Collins:
This is just an ugly/hygiene thing. Since we've never advertised the submodules
as the API, we should be able to fix this by moving main.py to e.g. __main__.py.
--
messages: 231101
nosy: rbcollins
priority: normal
severity: normal
status: open
Changes by Robert Collins :
--
components: +Library (Lib)
type: -> behavior
versions: +Python 3.5
___
Python tracker
<http://bugs.python.org/issue22858>
___
_
New submission from Robert Collins:
Before the argparse migration usageExit was invoked and could be extended via
subclasses, but it no longer is. We could delete it (and document it being no
longer accessible) or put some glue in to reinstate it. I think deleting it is
fine, as long as we
Changes by Robert Collins :
--
components: +Library (Lib)
type: -> behavior
versions: +Python 3.5
___
Python tracker
<http://bugs.python.org/issue22859>
___
_
New submission from Robert Collins:
Some users of TestProgram would like to add options (e.g. testtools.run adds
--list and --load-list) but there isn't a clean point to add them without bulk
copying the implementation around.
We likely need some extra extension points as well
New submission from Robert Collins:
TestProgram leaves defaultTestLoader.errors dirty. This primarily affects tests
but it would be good hygiene to clear it at the end of TestProgram.
--
components: Library (Lib)
messages: 231261
nosy: rbcollins
priority: normal
severity: normal
status
New submission from Robert Collins:
>From https://github.com/testing-cabal/testtools/issues/111 - any code that is
>data dependent can be hard to diagnose from a backtrace alone. Many unittest
>and server environments address this by doing custom tracebacks that include
>locals.
Changes by Robert Collins :
--
type: -> enhancement
___
Python tracker
<http://bugs.python.org/issue22936>
___
___
Python-bugs-list mailing list
Unsubscrib
New submission from Robert Collins:
>From https://github.com/testing-cabal/testtools/issues/111 - any code that is
>data dependent can be hard to diagnose from a backtrace alone. Many unittest
>and server environments address this by doing custom tracebacks that include
>locals.
Robert Collins added the comment:
See http://bugs.python.org/issue22936 for the unittest aspect of this.
--
___
Python tracker
<http://bugs.python.org/issue22
Robert Collins added the comment:
I'll put something together.
--
nosy: +rbcollins
___
Python tracker
<http://bugs.python.org/issue17911>
___
___
Pytho
Changes by Robert Collins :
--
nosy: +rbcollins
___
Python tracker
<http://bugs.python.org/issue12681>
___
___
Python-bugs-list mailing list
Unsubscribe:
Robert Collins added the comment:
w.r.t. a new linecache interface, it looks like we need two attributes from
f_globals: __name__ and __loader__, so that we can eventually call
__loader__.get_source(__name__).
One small change (to let me focus on traceback) would be to add another kw
Robert Collins added the comment:
Ok, here's a draft patch for linecache. Next up, poking around the new TB API.
--
Added file: http://bugs.python.org/file37700/linecache_1.patch
___
Python tracker
<http://bugs.python.org/is
Robert Collins added the comment:
One thing I noticed while working on this, traceback today stats each included
file once per frame per call into e.g. format_list. This might actually account
for quite some of the overhead. I'll include an optimisation for this in my new
API.
Robert Collins added the comment:
This is a WIP patch, including it to just share progress.
--
Added file: http://bugs.python.org/file37770/frame_1.patch
___
Python tracker
<http://bugs.python.org/issue17
Changes by Robert Collins :
Added file: http://bugs.python.org/file37769/linecache_2.patch
___
Python tracker
<http://bugs.python.org/issue17911>
___
___
Python-bug
Robert Collins added the comment:
And this improves the scaling of the cache stating overhead, but we may well
want to fix this more fundamentally - e.g. by linking the cache ownership into
the import system somehow, so that when a file is reimported, the cached source
is automatically
101 - 200 of 542 matches
Mail list logo