forked from CIDARLAB/pyparchmint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.py
34 lines (27 loc) · 961 Bytes
/
scripts.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
import glob
import subprocess
import sys
from pathlib import Path
from parchmint.device import Device
def test():
"""
Run all unittests. Equivalent to:
`poetry run python -u -m unittest discover`
"""
subprocess.run(["pytest", "-vv"])
def validate_dir_V1():
# glob through all the files in the argv directory with .json extension
files = glob.glob("{}/**/*.json".format(sys.argv[1]), recursive=True)
for file in files:
print(file)
file_path = Path(file).resolve()
with open(file_path) as data_file:
Device.validate_v1(data_file.read())
def validate_dir_V1_2():
# glob through all the files in the argv directory with .json extension
files = glob.glob("{}/**/*.json".format(sys.argv[1]), recursive=True)
for file in files:
print(file)
file_path = Path(file).resolve()
with open(file_path) as data_file:
Device.validate_v1(data_file.read())