Ezio Melotti added the comment:

> I found requires_bz2 and requires_lzma that already exist;

There's also requires_zlib.  import_module is also somewhat similar, but it's 
used to skip the whole test file when the module is missing.

> Here's another thought; would it be more useful to have a general
> version of this skip decorator in test.support

We were discussing this a couple of days ago on #python-dev.  Adding a 
skip_unless_module('modulename') (or requires_module('modulename')) and get rid 
of the several requires_* is certainly an option.

skip_unless_* (or requires_*) is shorter and more readable than 
skip_unless_module('modulename'), so this would be my preferred choice if it's 
defined and used within a single test module.  However if we add something to 
test.support, I'd rather have a more generic skip_unless_module('modulename') 
and get rid of the requires_*.
It's should also be possible to define specific ``skip_unless_x = 
skip_unless_module('x')`` in the test modules if necessary.

> should I just add a requires_gzip to test.support and use those three
> in test_tarfile?

I think that's reasonable for now -- we can always refactor it later and 
replace them with a skip_unless_module()

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17689>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to