[issue22153] There is no standard TestCase.runTest implementation

2014-10-29 Thread Robert Collins

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 ongoing push to split the protocol so that these concerns 
are not intertwined the way they are today, but that needs to wait for the 
existing backlog to clear up :)

--

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Robert Collins

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 clear about when it 
should be used, and how.

--

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 29/10/2014 00:22, Martin Panter a écrit :
> 
> Martin Panter added the comment:
> 
> Removing stuff from the documentation would make it hard to
> understand
what existing code means that uses runTest(). Isn’t this a case where
you would add a big red “Deprecated since version . . .” warning
instead? Maybe a comprimise would be to “hide” its documentation away in
a separate deprecated section or something.

Well, I wasn't proposing a deprecation (although that can be done as
well, if we want). I was proposing that this detail be hidden. I don't
know if it would make existing software harder to understand. I don't
think I've ever seen an actively-maintained project that used runTest().

The simple way to hide it would be to stop documenting the TestCase
constructor and its signature. You aren't supposed to instantiate
TestCase yourself.

--

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Martin Panter

Martin Panter added the comment:

Removing stuff from the documentation would make it hard to understand what 
existing code means that uses runTest(). Isn’t this a case where you would add 
a big red “Deprecated since version . . .” warning instead? Maybe a comprimise 
would be to “hide” its documentation away in a separate deprecated section or 
something.

--

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 28/10/2014 23:01, Robert Collins a écrit :
> 
> 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).

We don't need a deprecation path to remove something from the
documentation, IMO. It wouldn't break any existing code, it would just
reduce the cognitive load for newcomers.

(and, while people may have chosen to use runTest, it doesn't mean they
need it in any way)

--

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Robert Collins

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 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Martin Panter

Martin Panter added the comment:

Do you mean pretending there is no default “methodName” value, or pretending 
that the runTest() method is not invoked by discovery?

I would have to check, but I think I have relied on the runTest() method being 
discovered in the past, when I did not think a more original test method name 
was useful. Though I agree that it makes the behaviour more complicated for 
little extra flexibility.

--

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

IMO hiding the existence of `runTest` would be best. It doesn't seem to make 
anything more flexible, and it complicates the documentation.

--
nosy: +pitrou

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Martin Panter

Martin Panter added the comment:

The patch seems reasonable to me

--

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-10-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +rbcollins
stage:  -> patch review
versions: +Python 2.7

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-08-17 Thread evilzero

Changes by evilzero :


--
type:  -> enhancement

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-08-17 Thread evilzero

evilzero added the comment:

Updated documentation following suggestion.

--
keywords: +patch
nosy: +evilzero
Added file: http://bugs.python.org/file36401/myworkdoc.patch

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-08-08 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +ezio.melotti, michael.foord

___
Python tracker 

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



[issue22153] There is no standard TestCase.runTest implementation

2014-08-05 Thread Martin Panter

New submission from Martin Panter:

The documentation for "unittest.TestCase" says "the standard implementation of 
the default 'methodName', runTest(), will run every method starting with 'test' 
as an individual test". However:

>>> from unittest import *
>>> class Test(TestCase):
... def test_method(self): pass
... 
>>> t = Test()
>>> t.run()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.4/unittest/case.py", line 552, in run
testMethod = getattr(self, self._testMethodName)
AttributeError: 'Test' object has no attribute 'runTest'

After further experimentation, I see that if my test method is called 
"runTest", it can be automatically discovered, but only if there are no other 
test- prefixed methods.

Perhaps you could drop the end of the second paragraph for TestCase, so that it 
just reads:

Each instance of TestCase will run a single base method: the method named 
"methodName".

I think the details about the test- prefix and counting results are covered 
elsewhere, and in most uses you wouldn't instantiate a TestCase yourself, so 
changing the method name is irrelevant.

Also, perhaps under "TestLoader.loadTestsFromTestCase" it should say:

If no methods with the usual name prefix are found, but the "runTest" method is 
implemented, there will be a single test case using that method.

--
assignee: docs@python
components: Documentation
messages: 224907
nosy: docs@python, vadmium
priority: normal
severity: normal
status: open
title: There is no standard TestCase.runTest implementation
versions: Python 3.4, Python 3.5

___
Python tracker 

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