File: wvpytest.py

package info (click to toggle)
bup 0.33.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,720 kB
  • sloc: python: 15,905; sh: 5,799; ansic: 2,965; pascal: 669; makefile: 21
file content (60 lines) | stat: -rw-r--r-- 1,064 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import pytest

# Precaution -- here just because it's already imported "everywhere".

os.environb[b'BUP_DIR'] = b'/dev/null'
os.environb[b'GIT_DIR'] = b'/dev/null'

def WVPASS(cond = True, fail_value=None):
    if fail_value:
        assert cond, fail_value
    else:
        assert cond

def WVFAIL(cond = True):
    assert not cond

def WVPASSEQ(a, b, fail_value=None):
    if fail_value:
        assert a == b, fail_value
    else:
        assert a == b

def WVPASSNE(a, b):
    assert a != b

def WVPASSLT(a, b):
    assert a < b

def WVPASSLE(a, b):
    assert a <= b

def WVPASSGT(a, b):
    assert a > b

def WVPASSGE(a, b):
    assert a >= b

def WVEXCEPT(etype, func, *args, **kwargs):
    with pytest.raises(etype):
        func(*args, **kwargs)

def WVCHECK(cond, msg):
    assert cond, msg

def WVMSG(msg):
    print(msg)

wvpass = WVPASS
wvfail = WVFAIL
wvpasseq = WVPASSEQ
wvpassne = WVPASSNE
wvpaslt = WVPASSLT
wvpassle = WVPASSLE
wvpassgt = WVPASSGT
wvpassge = WVPASSGE
wvexcept = WVEXCEPT
wvcheck = WVCHECK
wvmsg = WVMSG
wvstart = WVMSG