Commit 8224ef06 authored by cpomies's avatar cpomies
Browse files

Changed call to EnabledSlots python script in unit test

parent d043993a
......@@ -50,7 +50,7 @@ def test_wrong_number_argument():
def test_no_data():
with TemporaryDir(chdir=True):
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 0
......@@ -59,7 +59,7 @@ def test_no_file():
with TemporaryDir(chdir=True):
os.makedirs('./configs')
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 0
......@@ -77,7 +77,7 @@ def test_one_file_json_chmod_111():
with open('configs/lhcb-TEST.json', 'w') as slot_file:
slot_file.write(json.dumps(conf_data))
os.chmod('configs/lhcb-TEST.json', 0111)
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/lhcb-TEST.json'))
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 0
......@@ -96,7 +96,7 @@ def test_one_file_json_disabled_flase():
os.makedirs('./configs')
with open('configs/lhcb-TEST.json', 'w') as slot_file:
slot_file.write(json.dumps(conf_data))
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/lhcb-TEST.json'))
assert json.load(open('configs/lhcb-TEST.json')) == conf_data
......@@ -116,7 +116,7 @@ def test_one_file_json_disabled_true():
os.makedirs('./configs')
with open('configs/lhcb-TEST.json', 'w') as slot_file:
slot_file.write(json.dumps(conf_data))
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/lhcb-TEST.json'))
assert json.load(open('configs/lhcb-TEST.json')) == conf_data
......@@ -135,7 +135,7 @@ def test_one_file_json_no_disabled():
os.makedirs('./configs')
with open('configs/lhcb-TEST.json', 'w') as slot_file:
slot_file.write(json.dumps(conf_data))
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/lhcb-TEST.json'))
assert json.load(open('configs/lhcb-TEST.json')) == conf_data
......@@ -154,7 +154,7 @@ def test_one_file_json_no_slot():
os.makedirs('./configs')
with open('configs/lhcb-TEST.json', 'w') as slot_file:
slot_file.write(json.dumps(conf_data))
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/lhcb-TEST.json'))
assert json.load(open('configs/lhcb-TEST.json')) == conf_data
......@@ -181,7 +181,7 @@ def test_two_file_json():
slot_file.write(json.dumps(conf_data1))
with open('configs/lhcb-TEST2.json', 'w') as slot_file:
slot_file.write(json.dumps(conf_data2))
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/lhcb-TEST1.json'))
assert exists(join('configs/lhcb-TEST2.json'))
......@@ -202,7 +202,7 @@ def test_one_job_xml_disbaled_false():
os.makedirs('./configs')
with open('configs/configuration.xml', 'w') as cfg_file:
cfg_file.write(test_xml)
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/configuration.xml'))
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 1
......@@ -220,7 +220,7 @@ def test_one_job_xml_disabled_true():
os.makedirs('./configs')
with open('configs/configuration.xml', 'w') as cfg_file:
cfg_file.write(test_xml)
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/configuration.xml'))
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 0
......@@ -238,7 +238,7 @@ def test_one_job_xml_no_disabled():
os.makedirs('./configs')
with open('configs/configuration.xml', 'w') as cfg_file:
cfg_file.write(test_xml)
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/configuration.xml'))
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 1
......@@ -258,7 +258,7 @@ def test_two_job_xml():
os.makedirs('./configs')
with open('configs/configuration.xml', 'w') as cfg_file:
cfg_file.write(test_xml)
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/configuration.xml'))
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 2
......@@ -286,7 +286,7 @@ def test_same_job_xml_and_json():
with open('configs/lhcb-TEST.json', 'w') as slot_file:
slot_file.write(json.dumps(conf_data))
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/configuration.xml'))
assert exists(join('configs/lhcb-TEST.json'))
......@@ -315,7 +315,7 @@ def test_different_job_xml_and_json():
with open('configs/lhcb-TEST.json', 'w') as slot_file:
slot_file.write(json.dumps(conf_data))
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--config-dir', 'configs'])
assert retval == 0
assert exists(join('configs/configuration.xml'))
assert exists(join('configs/lhcb-TEST.json'))
......@@ -324,7 +324,7 @@ def test_different_job_xml_and_json():
def test_one_job_param():
with TemporaryDir(chdir=True):
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', 'lhcb-test'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--slots','lhcb-test', '--config-dir', 'configs'])
assert retval == 0
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 1
......@@ -332,6 +332,6 @@ def test_one_job_param():
def test_two_job_param():
with TemporaryDir(chdir=True):
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', 'lhcb-test', 'lhcb-test2'])
retval = EnabledSlots.Script().run(['testing', 'slot-param-{0}.txt', '--slots', 'lhcb-test lhcb-test2', '--config-dir', 'configs'])
assert retval == 0
assert len([x for x in os.listdir('.') if re.match(r'^slot-param-.*\.txt', x)]) == 2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment