From 0385ad63b509935edd1951a98f80245b676bacfb Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sat, 23 Feb 2013 09:01:31 +0100 Subject: [PATCH] Skip zoo archive tests on Travis. --- tests/__init__.py | 12 ++++++++++++ tests/archives/test_zoo.py | 15 +++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 2e7465d..dc4dab2 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -87,3 +87,15 @@ def has_codec (program, codec): if patoolib.program_supports_compression(program, codec): return True return patoolib.util.find_program(codec) + + +def skip_on_travis(): + """Skip test if TRAVIS build environment is detected.""" + def check_func(func): + def newfunc(*args, **kwargs): + if "TRAVIS" in os.environ: + raise pytest.skip("Skip on TRAVIS CI build.") + return func(*args, **kwargs) + setattr(newfunc, fnameattr, getattr(func, fnameattr)) + return newfunc + return check_func diff --git a/tests/archives/test_zoo.py b/tests/archives/test_zoo.py index 56ad51a..9aaef56 100644 --- a/tests/archives/test_zoo.py +++ b/tests/archives/test_zoo.py @@ -14,18 +14,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . from . import ArchiveTest, Content -from .. import needs_program +from .. import needs_program, skip_on_travis class TestZoo (ArchiveTest): program = 'zoo' + # On a Travis CI build the test fails. + @skip_on_travis() @needs_program(program) def test_zoo(self): self.archive_commands('t.zoo', check=Content.Multifile) - # fails on Travis build - disable for now - #@needs_program('file') - #@needs_program(program) - #def test_zoo_file(self): - # self.archive_commands('t.zoo.foo', skip_create=True, check=Content.Multifile) + # On a Travis CI build the test fails. + @skip_on_travis() + @needs_program('file') + @needs_program(program) + def test_zoo_file(self): + self.archive_commands('t.zoo.foo', skip_create=True, check=Content.Multifile)