File: testutils.py

package info (click to toggle)
nbconvert 7.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,056 kB
  • sloc: python: 8,449; makefile: 199; javascript: 2
file content (13 lines) | stat: -rw-r--r-- 332 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
from shutil import which

import pytest


def onlyif_cmds_exist(*commands):
    """
    Decorator to skip test when at least one of `commands` is not found.
    """
    for cmd in commands:
        if not which(cmd):
            return pytest.mark.skip(f"This test runs only if command '{cmd}' is installed")
    return lambda f: f