10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-25 13:53:49 +01:00
quantum_package/tests/bats_to_sh.py

30 lines
494 B
Python
Raw Normal View History

2018-06-27 15:20:33 +02:00
#!/usr/bin/env python2
2016-02-19 00:20:28 +01:00
2016-10-07 19:21:04 +02:00
import sys
with open(sys.argv[1],'r') as f:
2016-02-19 00:20:28 +01:00
raw_data = f.read()
output = []
inside = False
level = 0
for i in raw_data:
new_i = i
if i == "@":
inside = True
elif i == "{" and inside and level == 0:
new_i = ""
elif i == "}" and inside and level == 1:
inside = False
new_i = ""
if i == "{":
level += 1
elif i == "}":
level -= 1
output.append(new_i)
print "".join(output).replace("@test","echo").replace("|| skip","|| return")