-
Notifications
You must be signed in to change notification settings - Fork 11
/
test_history_full.py
45 lines (35 loc) · 1.16 KB
/
test_history_full.py
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
URANIUM_PY = """
def main(build):
if not build.history.get("set", False):
print("false")
build.history["set"] = True
else:
print("true")
"""
from uranium.scripts import execute_script
from .conftest import URANIUM_SOURCE_ROOT
def test_history_full(tmpdir):
""" the history should be stored from run to run """
tmpdir.join("ubuild.py").write(URANIUM_PY)
status, out, err = execute_script(
"uranium_standalone", "--uranium-dir", URANIUM_SOURCE_ROOT,
cwd=tmpdir.strpath
)
assert "false" in out.decode("utf-8")
status, out, err = execute_script(
"uranium_standalone", "--uranium-dir", URANIUM_SOURCE_ROOT,
cwd=tmpdir.strpath
)
assert "true" in out.decode("utf-8")
URANIUM_PY_INVALID_HISTORY = """
def main(build):
build.history["foo"] = object()
"""
def test_history_full_invalid_history(tmpdir):
""" the history should be stored from run to run """
tmpdir.join("ubuild.py").write(URANIUM_PY_INVALID_HISTORY)
status, out, err = execute_script(
"uranium_standalone", "--uranium-dir", URANIUM_SOURCE_ROOT,
cwd=tmpdir.strpath
)
assert status != 0