File: test_whichcraft.py

package info (click to toggle)
whichcraft 0.4.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 112 kB
  • sloc: python: 113; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 372 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os

import pytest
from whichcraft import which


def test_existing_command():
    cmd = which('date')
    assert cmd
    assert os.path.exists(cmd)
    assert os.access(cmd, os.F_OK | os.X_OK)
    assert not os.path.isdir(cmd)


def test_non_existing_command():
    assert which('stringthatisntashellcommand') is None


if __name__ == '__main__':
    pytest.main()