diff --git a/tests/__init__.py b/tests/__init__.py index 643ebd9..17805e0 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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): diff --git a/tests/test_archives.py b/tests/test_archives.py index bb72507..3e0cc8e 100644 --- a/tests/test_archives.py +++ b/tests/test_archives.py @@ -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' diff --git a/tests/test_foo_archives.py b/tests/test_foo_archives.py index 4d85307..885c3b6 100644 --- a/tests/test_foo_archives.py +++ b/tests/test_foo_archives.py @@ -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):