def check_prog (f):
        def newfunc (*args, **kwargs):
            if not patoolib.util.find_program(program):
                pytest.skip("program `%s' not available" % program)
            if not has_codec(program, codec):
                pytest.skip("codec `%s' for program `%s' not available" % (codec, program))
            return f(*args, **kwargs)
        setattr(newfunc, fnameattr, getattr(f, fnameattr))
        return newfunc