Run AR format tests only on POSIX systems.

This commit is contained in:
Bastian Kleineidam 2010-03-08 22:04:27 +01:00
parent 37fa891535
commit 9a420df3a4
3 changed files with 14 additions and 0 deletions

View File

@ -105,6 +105,18 @@ class ArchiveTest (unittest.TestCase):
shutil.rmtree(tmpdir)
def needs_os (name):
"""Decorator skipping test if given program is not available."""
def check_prog (f):
def newfunc (*args, **kwargs):
if os.name != name:
raise nose.SkipTest("operating system %s not found" % name)
return f(*args, **kwargs)
newfunc.func_name = f.func_name
return newfunc
return check_prog
def needs_program (program):
"""Decorator skipping test if given program is not available."""
def check_prog (f):

View File

@ -213,6 +213,7 @@ class TestArchives (ArchiveTest):
self.program = 'arj'
self.archive_commands('t.arj')
@needs_os('posix')
@needs_program('ar')
def test_ar (self):
self.program = 'ar'

View File

@ -243,6 +243,7 @@ class TestArchives (ArchiveTest):
self.program = 'arj'
self.archive_commands('t.arj.foo', format="arj")
@needs_os('posix')
@needs_program('file')
@needs_program('ar')
def test_ar (self):