-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgrader
43 lines (32 loc) · 835 Bytes
/
grader
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
#!/usr/bin/env python3
import os
import click
DFL_CONFIG = '''# Uncomment and edit configuration options here
#weight: 1
#name: ''
#message: ''
#show_output: true
#timeout: null
#visibility: visible
'''
@click.group()
def cli():
pass
@cli.group()
def add():
pass
@add.command()
@click.option('-d', '--dir-name', required=True)
def test(dir_name):
tests_dir = os.path.join(os.path.curdir, 'tests')
if not os.path.exists(tests_dir):
click.echo('Error: tests directory not found')
return
new_test_dir = os.path.join(tests_dir, dir_name)
os.mkdir(new_test_dir)
with open(os.path.join(new_test_dir, 'test.yml'), 'w') as config_file:
config_file.write(DFL_CONFIG)
with open(os.path.join(new_test_dir, 'run_test'), 'w') as _:
pass
if __name__ == '__main__':
cli()