Michael Foord added the comment:
I'm unhappy with a straight change in behaviour because it will break code that
is currently catching AttributeError.
A slightly less invasive change would be to raise an AttributeError if the
module doesn't exist, otherwise letting the orig
Changes by Michael Foord :
--
assignee: -> michael.foord
___
Python tracker
<http://bugs.python.org/issue7559>
___
___
Python-bugs-list mailing list
Unsubscri
Michael Foord added the comment:
@Victor
IronPython doesn't use Python stack frames, so tracking them and then
constructing the objects on demand would add about a ~10% performance
hit to IronPython. Even when it is done it is likely to be an option
rather than on by default - using _get
Michael Foord added the comment:
Attached is an alternative patch that wraps the call to findCaller in a
try:...except.
Added file: http://bugs.python.org/file13116/logging2.patch
___
Python tracker
<http://bugs.python.org/issue5
New submission from Michael Foord :
I can't find any documentation for the __subclasses__ magic method. At
the very least needed for language implementors.
--
assignee: georg.brandl
components: Documentation
messages: 82504
nosy: georg.brandl, mfoord
severity: normal
status: open
New submission from Michael Foord :
There is a useful Scanner class in the re module which is undocumented.
See:
http://mail.python.org/pipermail/python-dev/2003-April/035075.html
http://www.evanfosmark.com/2009/02/sexy-lexing-with-python/
--
assignee: georg.brandl
components
Michael Foord added the comment:
New patch with assertRaisesWithRegexMatch as a context manager.
--
keywords: +patch
nosy: +mfoord
Added file: http://bugs.python.org/file13484/unittest-new-asserts.diff
___
Python tracker
<http://bugs.python.
Michael Foord added the comment:
Updated patch with asserts in unittest changed to explicitly raising
self.failureException, hardcoded AssertionError in tests changed to
self.failureException and addition of assertRegexMatches.
--
Added file: http://bugs.python.org/file13488/unittest
Michael Foord added the comment:
If the deprecation causes noise people can just turn off the deprecation
warning surely?
Especially as transforming a codebase really is as simple as a global
search and replace. Personally I'd prefer earlier deprec
New submission from Michael Foord :
Patch for unittest on trunk.
It provides better default failure messages for assertTrue and
assertFalse (current is "AssertionError: None").
It also provides a new class attribute for TestCase: longMessage
This defaults to False. If set to True,
Michael Foord added the comment:
Reviewers: ,
Description:
Patch for unittest on trunk.
It provides better default failure messages for assertTrue and
assertFalse (current is "AssertionError: None").
It also provides a new class attribute for TestCase: longMessage
This defaults to
Michael Foord added the comment:
Updated patch with better docstring for _formatMessage and docs.
Patch reviewed by Brett Cannon so will commit.
--
Added file: http://bugs.python.org/file13568/unittest-messages.diff
___
Python tracker
<h
Changes by Michael Foord :
--
resolution: -> accepted
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue5663>
___
___
Python-bugs-list
Changes by Michael Foord :
--
nosy: +michael.foord
___
Python tracker
<http://bugs.python.org/issue5660>
___
___
Python-bugs-list mailing list
Unsubscribe:
Michael Foord added the comment:
This is a workaround:
import copy
copy._deepcopy_dispatch[types.MethodType] = copy._deepcopy_atomic
--
___
Python tracker
<http://bugs.python.org/issue5
Michael Foord added the comment:
We can fix this by wrapping the assert functions in our assert register
as deep-copyable objects. (And then unwrapping when we fetch them.)
--
___
Python tracker
<http://bugs.python.org/issue5
Michael Foord added the comment:
Fixed in revision 71043.
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/
Michael Foord added the comment:
Why do you need the assert methods to go away in order to use assert
statements?
--
___
Python tracker
<http://bugs.python.org/issue2
Michael Foord added the comment:
No - you catch self.failureException rather than AssertionError directly.
I use unittest precisely because of the rich failure information from
the assert methods - particularly the new ones in this patch
Michael Foord added the comment:
+1 on adding a cleanUp list where entries are executed unconditionally
even on failure of setUp.
If there is consensus that this is a good thing (looks like it to me
from the discussion here) then I can apply the patch to head.
I'll review it first and
Michael Foord added the comment:
OK, so the patch as submitted *isn't* for the cleanUp suggestion (d'oh -
I should have read it before posting the last comment).
One possibility is that this bug is closed as won't fix (the patch as
provided should definitely not be applied
Michael Foord added the comment:
Why is assertMultiLineEqual not the default assert method for basestring?
Even for small strings the output is useful.
--
___
Python tracker
<http://bugs.python.org/issue2
New submission from Michael Foord :
Proposal to add a cleanUp stack to unittest.TestCase. This is a list of
callables to be called (LIFO) to cleanup resources. If there are items
on the stack it should be called even if setUp fails. Otherwise it
should be called after tearDown.
Similar
Michael Foord added the comment:
This is a nice (simple to use and understand) pattern for resource
allocation / deallocation.
Supporting the cleaning up of resources when setUp fails (without
duplicating clean up code) is just one use case. (I agree setUp failure
is unusual.)
It provides a
Michael Foord added the comment:
>From your example this would completely remove the need for the
conditional checking in the cleanup code. Only resources actually
allocated would be in the stack.
--
___
Python tracker
<http://bugs.pyth
Michael Foord added the comment:
Fair point. :-)
--
___
Python tracker
<http://bugs.python.org/issue2578>
___
___
Python-bugs-list mailing list
Unsubscribe:
Michael Foord added the comment:
Closing. The patch as suggested should not be applied. Instead tearDown
should be called in a finally block in the setUp for this specific use case.
I've created a new issue (#5679) for the cleanUp idea which I think is
Changes by Michael Foord :
--
type: behavior -> feature request
___
Python tracker
<http://bugs.python.org/issue5679>
___
___
Python-bugs-list mailing list
Un
Michael Foord added the comment:
And actually your conditionally_undo_setup() call in setUp is incorrect.
It should in an except block that re-raises rather than a finally block
(which will do the cleanup even in non-exceptional circumstances). Easy
code to get wrong
Michael Foord added the comment:
Running out of time for 2.7 as well...
--
nosy: +michael.foord
___
Python tracker
<http://bugs.python.org/issue1745>
___
___
Michael Foord added the comment:
I'd like to add assertIs and assertNotIs.
We have these at work and I would find them useful whilst writing tests
for another set of changes to unittest I'm currently working on!
--
___
Python trac
Michael Foord added the comment:
I would *mmuch* prefer assertIsNot but it is not symmetrical with the
other asserts.
--
___
Python tracker
<http://bugs.python.org/issue2
Michael Foord added the comment:
Patch attached.
No docs, if it is agreed I can apply I'll write docs.
After a long discussion we arrived at some semblance of consensus on the
Testing In Python mailing list that this was a good thing (tm).
Only one -1 (thought that cleanUp should be a m
Michael Foord added the comment:
I'm agnostic on before / after tearDown, so happy to make that change.
--
___
Python tracker
<http://bugs.python.org/i
Michael Foord added the comment:
Patch with assertIs and assertIsNot. Docs but nothing in NEWS as already
covered.
Ok to apply?
--
Added file: http://bugs.python.org/file13613/unittest-assertis.diff
___
Python tracker
<http://bugs.python.
Michael Foord added the comment:
Patch for Py3k with fallback for comparing unsortable sequences in
assertSameElements.
Removed the expected failure and added another test case to confirm that
this patch works for unsortable sequences that are the same (no fail)
and different (fail
Michael Foord added the comment:
+1 it's a minor change.
--
nosy: +michael.foord
___
Python tracker
<http://bugs.python.org/issue5693>
___
___
Python-bugs-l
Michael Foord added the comment:
Antoine, Robert suggests calling it after tearDown so that tearDown can
also perform actions that need clean up. Not a common use case but at
least a use case. What do you mean by:
"so that test cases can also use it to initialize
additional resource
Michael Foord added the comment:
The main use case for addCleanup is resource allocation in tests. Why
does this require clean ups to be executed before tearDown?
--
___
Python tracker
<http://bugs.python.org/issue5
Changes by Michael Foord :
--
resolution: -> accepted
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue5693>
___
___
Python-bugs-list
Michael Foord added the comment:
Committed in revision 71263. Closing as there is nothing outstanding on
this issue.
--
resolution: -> accepted
status: open -> closed
___
Python tracker
<http://bugs.python.org/
Michael Foord added the comment:
IDLE catches the SystemExit function raised by TestProgram().runTests()
and prints the traceback. Not a bug in unittest.
--
nosy: +michael.foord
resolution: -> works for me
status: open -> closed
___
Python t
Michael Foord added the comment:
I'm in favour of running clean ups afterwards on the basis that it makes
things possible that would otherwise not be possible.
> If your cleanup relies on something which has been set up during setUp
> and will be dropped during tearDown (a database
Michael Foord added the comment:
A use case for running clean ups before tearDown (in which case
addCleanUp would need to raise an exception if called during tearDown).
You have existing code which (for example) creates an SSH connection in
setUp and removes it in tearDown.
If clean ups are
Michael Foord added the comment:
This is actually a minor point about the order things happen in. I don't
think it will cause confusion in practise once we have made a decision
and documented it.
Particularly if we decide to call clean ups before tearDown then I will
make adding new
Michael Foord added the comment:
@Garrett / Virgil
I don't think anything other than very short term confusion is possible.
Whichever decision is made a developer who assumes the opposite will
actually get an error. In both cases the downside is that in certain
circumstances you could at
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/head%3A/testtools/testcase.py
--
___
Python tracker
<http://bugs.python.
Changes by Michael Foord :
--
nosy: +michael.foord -fuzzyman
___
Python tracker
<http://bugs.python.org/issue1774840>
___
___
Python-bugs-list mailing list
Unsub
Changes by Michael Foord :
--
stage: test needed -> needs patch
___
Python tracker
<http://bugs.python.org/issue1774840>
___
___
Python-bugs-list mai
Michael Foord added the comment:
Seems like a straightforward request although TestProgram is pretty
horrible in my opinion. I'll add an exit argument to
TestProgram.__init__ - don't look forward to testing it though.
--
___
Python trac
Michael Foord added the comment:
Not returning the results is not a problem - if you needed access to the
results you would hardly be using this API in the first place.
The obvious use case if for running tests from an interactive
environment where you are using the visual output on stdout
Michael Foord added the comment:
This feature request was recently implemented using the 'longMessage'
class attribute on TestCase.
--
resolution: -> out of date
status: open -> closed
___
Python tracker
<http://bugs.pyt
Michael Foord added the comment:
startTestRun and stopTestRun sound good to me.
--
___
Python tracker
<http://bugs.python.org/issue5728>
___
___
Python-bug
Michael Foord added the comment:
Oops... sorry about that, will fix.
--
___
Python tracker
<http://bugs.python.org/issue5826>
___
___
Python-bugs-list mailin
Michael Foord added the comment:
Closed in revision 71930.
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/
Michael Foord added the comment:
Patch that adds the same exit functionality, but also stores the result
as an instance attribute on the return TestProgram instance.
As this functionality has been requested several times my intention is
to apply this patch.
--
Added file: http
Michael Foord added the comment:
Damn - proper patch without extraneous stuff this time.
--
Added file: http://bugs.python.org/file13786/unittest-no-exit.patch
___
Python tracker
<http://bugs.python.org/issue5
Changes by Michael Foord :
Removed file: http://bugs.python.org/file13786/unittest-no-exit.patch
___
Python tracker
<http://bugs.python.org/issue5679>
___
___
Python-bug
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
___
Python tracker
<http://bugs.python.org/issue5
Michael Foord added the comment:
Is this made obsolete by test skipping?
--
nosy: +michael.foord
___
Python tracker
<http://bugs.python.org/issue3202>
___
___
New submission from Michael Foord :
_makeLoader, getTestCaseNames, makeSuite and findTestCases have all had
the comment "these functions should be considered obsolete" for a long time.
Is is ok to go straight to deprecation or should they be marked with
PendingDeprecationWar
Michael Foord added the comment:
I'm intending to implement loadTestsFromPackage which will do a
*similar* job. As well as allowing test autodiscovery it will allow for
customizing test loading from modules / packages using a protocol
thrashed out on the Testing in Python mailing
Changes by Michael Foord :
Removed file: http://bugs.python.org/file13784/unittest-no-exit.patch
___
Python tracker
<http://bugs.python.org/issue3379>
___
___
Python-bug
Michael Foord added the comment:
Damn somehow managed to upload the patch to the wrong issue twice in a
row. Must have been late at night.
--
___
Python tracker
<http://bugs.python.org/issue3
Michael Foord added the comment:
Correct patch this time. If there are no objections I'll apply this in a
couple of days.
--
Added file: http://bugs.python.org/file13790/unittest-no-exit.patch
___
Python tracker
<http://bugs.python.org/i
Michael Foord added the comment:
Updated patch with docs. My intention is to apply this in the next
couple of days.
I've settled on calling doCleanups *after* tearDown. The issues and
reasoning explained below.
One point of view concerns using addCleanups with existing tests.
If the
New submission from Michael Foord :
Removes some blank lines from unittest.rst that were suppressing some
version changed messages from appearing in output.
Also added documentation for TestSuite.__iter__ and
TextTestRunner._makeResult as they are unittest extensibility points.
I see
Michael Foord added the comment:
Whether it was intended to be exposed or not it is known and used - and
therefore we can't change the API without going through the usual
deprecation process. As it is used and useful it should be docum
Michael Foord added the comment:
Committed in revision 71291.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue3379>
___
___
Python-
Michael Foord added the comment:
No, make that revision 72191. :-)
--
___
Python tracker
<http://bugs.python.org/issue3379>
___
___
Python-bugs-list mailin
Michael Foord added the comment:
Committed in revision 72219.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue5679>
___
___
Python-
Michael Foord added the comment:
Committed in revision 72225.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue5728>
___
___
Python-
Michael Foord added the comment:
So it turns out that unittest.makeSuite is used about 100 times
throughout the standard library tests.
More than half the time it can be replaced with
unittest.TestLoader().loadTestsFromTestCase(...)
Some of the other times a loader needs to be constructed and
New submission from Michael Foord :
It would be really nice if unittest.TestLoader.loadTestsFromNames
accepted module and class names.
My main motivation for that is so that I can do:
python -m unittest module_name
There is no backwards compatibility issue as currently this doesn't
Michael Foord added the comment:
Actually they do - it is an obscure bug in the way the module is
specified in TestProgram that prevents this from working.
The code in parseArgs that is currently:
if len(args) > 0:
self.testNames = args
Should probably
New submission from Michael Foord :
This patch adds a verbosity keyword argument to unittest.main - so you
can do:
if __name__ == '__main__':
unittest.main(verbosity=2)
It also has a minor fix allowing you to specify test modules / classes
from the command line. Th
Michael Foord added the comment:
I didn't add the issue number because I created the patch prior to
creating the issue. Will add when I commit. Would like permission to
commit this from an interested core developer.
--
___
Python tracker
Michael Foord added the comment:
Committed in revision 72570.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue5995>
___
___
Python-
New submission from Michael Foord :
Attached is a patch that implements test discovery for unittest.
It includes command line argument handling (awkward manual handling but
works fine...), so that it can be invoked through:
python -m unittest discover
python -m unittest discover
Michael Foord added the comment:
Hehe - I wasn't actually doing that, just replacing the use of the
obsolete functions.
--
___
Python tracker
<http://bugs.python.org/i
Michael Foord added the comment:
This commit caused a regression in command line behavior of modules
using unittest.main(). Fixed in revision 72583.
--
___
Python tracker
<http://bugs.python.org/issue5
Michael Foord added the comment:
The usage information in TestProgram in this patch is not correct.
If __name__ != __main__ it should be unchanged - the new usage message
should only be displayed if unittest is run as __main__.
--
___
Python
Michael Foord added the comment:
See issue 6001 for a patch implementing test discovery for unittest.
It would allow you to do:
python -m unittest discover
--
___
Python tracker
<http://bugs.python.org/issue1
Michael Foord added the comment:
Needs test and documentation. Otherwise looks good.
--
___
Python tracker
<http://bugs.python.org/issue4080>
___
___
Python-bug
Michael Foord added the comment:
Patch is fine. I'll apply shortly. There was a specific use case for
being able to call doCleanups directly which was why the results object
needed to be stored.
--
___
Python tracker
<http://bugs.py
Michael Foord added the comment:
Committed in revision 72812.
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/
Michael Foord added the comment:
Updated patch with documentation and fixed command line usage message.
Unless there are objections I intend to check this in in the next few
days. It would be helpful if someone else could go over the
documentation and check for errors / typos etc.
I
Michael Foord added the comment:
Georg Brandl has pointed out various minor issues in the docs (and
discover docstring) that I am correcting.
--
___
Python tracker
<http://bugs.python.org/issue6
Michael Foord added the comment:
http://codereview.appspot.com/63157
--
___
Python tracker
<http://bugs.python.org/issue6001>
___
___
Python-bugs-list mailin
Michael Foord added the comment:
Committed in revision 73027.
--
resolution: -> accepted
status: open -> closed
___
Python tracker
<http://bugs.python.org/
New submission from Michael Foord :
In Python 2.6 the testRunner keyword argument to unittest.main
(TestProgram) changed from None to TextTestRunner.
This breaks test suites (like the setuptools tests) which pass in None
when not wanting to override the default.
This is easy to fix without
Michael Foord added the comment:
Patch attached.
--
keywords: +patch
Added file: http://bugs.python.org/file14155/fix_unittest_main.patch
___
Python tracker
<http://bugs.python.org/issue6
Michael Foord added the comment:
A module can now define load_tests (used by loadTestsFromModule) and
exclude certain classes itself.
--
resolution: -> wont fix
status: open -> closed
___
Python tracker
<http://bugs.python.org/iss
Michael Foord added the comment:
Committed to trunk in revision 73151 and revision 73152.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/iss
Michael Foord added the comment:
Similar functionality is now in TestLoader.discover.
--
resolution: -> rejected
status: open -> closed
___
Python tracker
<http://bugs.python.org/
Michael Foord added the comment:
Thanks - I should have tested on Windows first. Tests now pass on
Windows and Mac OS X. Committed revision 73247.
--
resolution: -> accepted
status: open -> closed
___
Python tracker
<http://bugs.p
Michael Foord added the comment:
This was suggested before on Python-dev and Guido rejected it as it is
an 'odd' API for a unittest assert method - none of the others return
anything.
--
resolution: -> rejected
status: open -> closed
__
Michael Foord added the comment:
Well, his comment was made after assertRaises had already been made a
context manager.
Keeping the exception attached to the context manager is an interesting
suggestion and a less 'surprising' change
Michael Foord added the comment:
I disagree that the regex version is half-assed though. If all you want
to do is to make assertions about the exception message (the most common
use case in *my* experience) it is enormously convenient.
--
___
Python
Michael Foord added the comment:
Patch needs updating but still seems like a useful feature. I'll update
and commit. I agree that decorator should be lowercase - should_fail or
shouldfail ?
--
___
Python tracker
<http://bugs.python.org/issu
801 - 900 of 1077 matches
Mail list logo