forked from intelligent-agent/redeem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_redeem.py
executable file
·60 lines (46 loc) · 1.3 KB
/
test_redeem.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python
from redeem.GCodeProcessor import GCodeProcessor
from redeem.Redeem import Redeem
from redeem.Gcode import Gcode
import logging
def test_redeem():
r = Redeem("/usr/src/redeem/configs")
r.printer.enable.set_enabled()
g = r.printer.processor
for gcode in g.get_test_gcodes():
logging.info("Testing '"+gcode.message+"'")
g.execute(gcode)
r.exit()
pass
def test_load():
r = Redeem("/usr/src/redeem/configs")
r.exit()
def test_run():
from redeem.Redeem import main
main("/usr/src/redeem/configs")
def test_code(test_str):
r = Redeem("/usr/src/redeem/configs")
r.printer.enable.set_enabled()
g = r.printer.processor
for line in test_str.splitlines():
if line:
print line
g.execute( Gcode({"message": line, "prot":"testing"}) )
r.exit()
def test_file(test):
r = Redeem("/usr/src/redeem/configs")
r.printer.enable.set_enabled()
g = r.printer.processor
f = open(test,'r')
for line in f.readlines():
if line:
print line
g.execute( Gcode({"message": line, "prot":"testing"}) )
r.exit()
f.close()
if __name__ == "__main__":
test_str = """
G28 Z0
"""
test_code(test_str)
print "Test finished"