Skip to content

Commit

Permalink
Added unit tests for various elements of Operon
Browse files Browse the repository at this point in the history
  • Loading branch information
djf604 committed Apr 16, 2018
1 parent 26ebab1 commit 32753e8
Show file tree
Hide file tree
Showing 5 changed files with 414 additions and 1 deletion.
24 changes: 24 additions & 0 deletions tests/malformed_config.json
@@ -0,0 +1,24 @@
{
"sites": [{
"site": "four_jobs",
"auth": {
"channel": "ssh",
"hostname": "192.170.228.90",
"username": "dominic",
"scriptDir": "/cephfs/users/dominic/.ippscripts"
},
"execution": {
"executor": "ipp",
"provider: "slurm",
"block": {
"nodes": 1,
"taskBlocks": 1,
"initBlocks": 1,
"maxBlocks": 3,
"minBlocks": 1,
"walltime": "48:00:00"
}
}
}],
"globals": {"lazyErrors": true}
}
19 changes: 19 additions & 0 deletions tests/petrichor
@@ -0,0 +1,19 @@
#!/usr/bin/env python

import argparse
import time
import random

parser = argparse.ArgumentParser()
parser.add_argument('--sleep', type=int)
parser.add_argument('--outfile')
args = vars(parser.parse_args())

if args['sleep']:
time.sleep(args['sleep'])

if args['outfile']:
with open(args['outfile'], 'w') as outfile:
outfile.write('{}\n'.format(args['outfile']))
else:
print(random.randint(1, 1000))
2 changes: 1 addition & 1 deletion tests/test_cli.py
Expand Up @@ -33,6 +33,7 @@ def operon_install(operon_root):


def operon_init(args='', tmpdir=None, cleanup=True):
print(os.path.expanduser('~'))
subprocess.call('operon init {}'.format(args), shell=True)

if args != 'help':
Expand Down Expand Up @@ -65,7 +66,6 @@ def operon_init(args='', tmpdir=None, cleanup=True):
return True



def test_cli(tmpdir_factory):
assert operon_init(args='help')
assert operon_init(args=str(tmpdir_factory.mktemp('user_defined')))
Expand Down

0 comments on commit 32753e8

Please sign in to comment.