Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin Whan Bae committed Aug 7, 2020
1 parent ec4caf7 commit 652f8f7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/integration_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import numpy as np
import unittest
#import cyclus_gui.gui.gui
from cyclus_gui.gui.sim_window import SimulationWindow
from cyclus_gui.gui.arche_window import ArchetypeWindow
from cyclus_gui.gui.proto_window import PrototypeWindow
from cyclus_gui.gui.region_window import RegionWindow
from cyclus_gui.gui.recipe_window import RecipeWindow
from cyclus_gui.gui.backend_window import BackendWindow
import os
import shutil
from tkinter import *
import xmltodict

## go from start to finish
here = os.path.dirname(os.path.abspath(__file__))

uniq_id = 'test'
root = Tk()
output_path = os.path.join(here, 'output_test')
if os.path.isdir(output_path):
shutil.rmtree(output_path)
os.mkdir(output_path)

def test_simulation(root, output_path):
#simulation
#obj.open_window('simulation', output_path)
# simulation window object
obj = SimulationWindow(root, output_path)
obj.entry_dict['duration'].insert(END, 320)
obj.entry_dict['startmonth'].insert(END, 1)
obj.done()

# check output
xml_dict = xmltodict.parse(open(os.path.join(output_path, 'control.xml')).read())['control']
answer_dict = {'duration': 320,
'startmonth': 1,
'startyear': 2019,
'decay': 'lazy'}
for k, v in answer_dict.items():
if xml_dict[k] != str(v):
print('Input %s Should be %s, it is written as %s' %(k, v, xml_dict[k]))
return False
return True



2 changes: 2 additions & 0 deletions tests/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from cyclus_gui.gui.backend_window import BackendWindow
import os

here = os.path.dirname(os.path.abspath(__file__))

def skip_init(cls):
actual_init = cls.__init__
Expand Down Expand Up @@ -42,5 +43,6 @@ def test_get_metafile_from_git(self):
for i in answer:
self.assertTrue(i in arche)


if __name__ == '__main__':
unittest.main()

0 comments on commit 652f8f7

Please sign in to comment.