[issue17519] unittest should not try to run abstract classes

2021-04-01 Thread Stephen Thorne


Stephen Thorne  added the comment:

I have done some experimentation here and thought through this feature request.

The concept we are trying to deliver is: "I would like to share functionality 
between test classes, by having an abstract parent, with concrete leaves"

The metaclass abc.ABCMeta provides functionality that means two things:

 - any class with this metaclass (so the class and all its subclasses, 
typically) that have @abc.abstractmethod or @abc.abstractproperty decorated 
methods will be treated as abstract
 - any class that is treated as abstract will raise an exception immediately, 
to make it clear to the programmer (and unit tests) that a programming error 
has occured.

Following this through, we end up with two ways in which this can go  wrong in 
unit testing if we ask our unit testing framework to not test abstract classes.

This is a complete example, with both failure modes illustrated:

Consider:

class AbstractTestCase(unittest.TestCase, metaclass=abc.ABCMeta):
  ...

class FooTest(AbstractTestCase):
  def foo(self):
return 1

In this case, AbstractTestCase will not be skipped: this is because without any 
abstract methods inside it: it's not actually considered 'abstract', and is a 
concrete class.

In the second case:

class AbstractTestCase(unittest.TestCase, metaclass=abc.ABCMeta):
  @abc.abstractmethod
  def foo(self):
...

  @abc.abstractmethod
   def bar(self):
...

class FooTest(AbstractTestCase):
  def foo(self):
return 1

In this case, because AbstractTestCase has 2 abstract methods, it will be 
skipped. No tests run. But also FooTest will be skipped because it has 1 
abstract method, and is therefore also abstract.

If this were a 'normal' program, we would see an exception raised when FooTest 
is instanciated, but because we're skipping tests in abstract classes, we skip 
all the tests and exit with success.

My gut feeling on this is that what we really want is a decorator that says: 
Skip this class, and only this class, explicitly. All subclasses are concrete, 
only this one is abstract.

--
nosy: +sthorne

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



[issue14905] zipimport.c needs to support namespace packages when no 'directory' entry exists

2012-08-19 Thread Stephen Thorne

Stephen Thorne added the comment:

Please see attached new patch, based on review comments.

--
Added file: http://bugs.python.org/file26894/zipimport-issue14905-2.patch

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



[issue14826] urllib2.urlopen fails to load URL

2012-07-08 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Here's a followup patch that fixes the trunk build for me.

This will unbreak the builds as well as fixing this bug, but it should be 
investigated why URLopener calls to_bytes() and Request does not. Ideally this 
interface should be consistent.

--
Added file: http://bugs.python.org/file26314/urllib-request.patch

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



[issue14905] zipimport.c needs to support namespace packages when no 'directory' entry exists

2012-07-07 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Here is a patch that synthesises the directory names at the point where file 
names are read in. The unit test now passes, and has had the expected failure 
removed.

Patch collaboration with Diarmuid Bourke diarmuidbou...@gmail.com at the 
europython sprint.

--
keywords: +patch
nosy: +jerub
Added file: http://bugs.python.org/file26302/zipimport-issue14905.patch

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



[issue11319] Command line option -t (and -tt) does not work for a particular case

2012-07-07 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

In discussion with GvR, we've decided we're not interested in intentionally 
rejecting code that is valid for tab width values between 1 and 8 inclusive.

Thanks for the bug report!

--
nosy: +jerub

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



[issue1508475] transparent gzip compression in urllib

2012-07-07 Thread Stephen Thorne

Changes by Stephen Thorne step...@thorne.id.au:


--
nosy: +jerub

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-07 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

With the attached patch, with python3.3(trunk) I instead get: 

./python.exe  -c 'import _elementtree'
Traceback (most recent call last):
  File string, line 1, in module
  File frozen importlib._bootstrap, line 1294, in _find_and_load
  File frozen importlib._bootstrap, line 1261, in _find_and_load_unlocked
  File frozen importlib._bootstrap, line 432, in _check_name_wrapper
  File frozen importlib._bootstrap, line 347, in set_package_wrapper
  File frozen importlib._bootstrap, line 360, in set_loader_wrapper
  File frozen importlib._bootstrap, line 872, in load_module
ImportError: PyCapsule_Import could not import module pyexpat

(I have deleted pyexpat.so out of the build for the purposes of testing)

RuntimeError will continue to be raised in the case the version is wrong.

--
keywords: +patch
nosy: +jerub
Added file: http://bugs.python.org/file26310/elementtree_importerror.patch

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



[issue14826] urllib2.urlopen fails to load URL

2012-07-07 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Here is a patch that uses the same quoting logic in 
urllib.request.Request.__init__ as is used by urllib.request.URLopener.open()

--
keywords: +patch
nosy: +jerub
versions: +Python 3.3 -Python 2.7
Added file: http://bugs.python.org/file26311/urllib-quote-14826.patch

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



[issue11104] distutils sdist ignores MANIFEST

2012-02-03 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Yep - 2.7.2 was released 11th June 2011, the fix was committed Aug 1st 2011. So 
it won't be in the current 2.7 release.

--

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



[issue11104] distutils sdist ignores MANIFEST

2011-06-25 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Éric mentioned that i should check that this behaviour matches the 
documentation. I have gone and looked for all instances of MANIFEST in the 
documentation and found one place which was inconsistent. I've added the doc 
patch to the patch. Please review this new version.

--
Added file: http://bugs.python.org/file22463/manifest-respect-3

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



[issue10510] distutils upload/register should use CRLF in HTTP requests

2011-06-25 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

I'm having a look at this ticket now. It looks like this can be rewritten to 
use common code, and it would probably be good to use the 'email' module for 
creating the MIME segements properly.

--
nosy: +jerub

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



[issue10510] distutils upload/register should use CRLF in HTTP requests

2011-06-25 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Okay, I looked at this, then I ran into str/byte type problems with the email 
module. Will wait until 'email' is sorted out before I consider a ticket like 
this one again.

--

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



[issue11104] distutils sdist ignores MANIFEST

2011-06-24 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

I have 2 patches, with tests, that applies on python2.7 and the python3 series 
of branches, attached this ticket. I have also got a signed contributor 
agreement lodged with the PSF.

Can I please have someone either apply my patches or tell me what I need to do 
in order to change them if they are being rejected.

--

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



[issue11104] distutils sdist ignores MANIFEST

2011-06-24 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Oh! I didn't see any notification that there was a review done. Thanks, I'll 
attend to that.

--

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



[issue11104] distutils sdist ignores MANIFEST

2011-06-24 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

This patch is an updated patch that fixes the things noted in the review from 
eric.araujo.

--
Added file: http://bugs.python.org/file22437/manifest-respect-3

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



[issue11104] distutils sdist ignores MANIFEST

2011-06-24 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Updated the patch to address the 'why not use .strip()' question. I used 
.rstrip('\r\n') on the basis that filenames may have leading or trailing 
spaces, and if you need that, you need to be able to specify that in a 
MANIFEST, but it is perfectly logical to disallow them, so here's a patch that 
doesn't support them.

It also reduces the line count by 2 because I'm composing the 'comment' and 
'blank line' cases.

--
Added file: http://bugs.python.org/file22449/manifest-respect-3

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



[issue11104] distutils sdist ignores MANIFEST

2011-06-04 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

I've taken the sdist.patch and wrote some tests for it. The resulting patch is 
attached as 'manifest-respect.patch'.

--
nosy: +jerub
Added file: http://bugs.python.org/file22242/manifest-respect.patch

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



[issue11104] distutils sdist ignores MANIFEST

2011-06-04 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

This patch is tested against the 3.1 and default branches, the previous patch 
attached was against the 2.7 branch.

--
Added file: http://bugs.python.org/file22243/manifest-respect-3.patch

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