]> arthur.barton.de Git - bup.git/blob - lib/bup/t/thelpers.py
Add helpers.detect_fakeroot() and use it in relevant metadata tests.
[bup.git] / lib / bup / t / thelpers.py
1 import os
2
3 from bup.helpers import *
4 from wvtest import *
5
6 @wvtest
7 def test_parse_num():
8     pn = parse_num
9     WVPASSEQ(pn('1'), 1)
10     WVPASSEQ(pn('0'), 0)
11     WVPASSEQ(pn('1.5k'), 1536)
12     WVPASSEQ(pn('2 gb'), 2*1024*1024*1024)
13     WVPASSEQ(pn('1e+9 k'), 1000000000 * 1024)
14     WVPASSEQ(pn('-3e-3mb'), int(-0.003 * 1024 * 1024))
15
16
17 @wvtest
18 def test_detect_fakeroot():
19     if os.getenv('FAKEROOTKEY'):
20         WVPASS(detect_fakeroot())
21     else:
22         WVPASS(not detect_fakeroot())