configurationengine/source/plugins/example/integration-test/unittest_generate.py
changeset 3 e7e0ae78773e
parent 0 2e8eeb919028
equal deleted inserted replaced
2:87cfa131b535 3:e7e0ae78773e
    14 #
    14 #
    15 # Description:
    15 # Description:
    16 #
    16 #
    17 
    17 
    18 import sys, os, shutil, unittest
    18 import sys, os, shutil, unittest
    19 import __init__
    19 
    20 from testautomation.base_testcase import BaseTestCase
    20 from testautomation.base_testcase import BaseTestCase
    21 from testautomation import zip_dir
    21 from testautomation import zip_dir
    22 
    22 
    23 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    23 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    24 
    24 
    25 if sys.platform == "win32":
    25 if sys.platform == "win32":
    26     CONE_SCRIPT = "cone.cmd"
    26     CONE_SCRIPT = "cone.cmd"
    27 else:
    27 else:
    28     CONE_SCRIPT = "cone.sh"
    28     CONE_SCRIPT = "cone"
    29 
    29 
    30 def get_cmd(action='generate'):
    30 def get_cmd(action='generate'):
    31     """Return the command used to run the ConE sub-action"""
    31     """Return the command used to run the ConE sub-action"""
    32     if 'CONE_PATH' in os.environ:
    32     if 'CONE_PATH' in os.environ:
    33         CONE_CMD = os.path.join(os.environ['CONE_PATH'], CONE_SCRIPT)
    33         CONE_CMD = os.path.join(os.environ['CONE_PATH'], CONE_SCRIPT)
    75         try:
    75         try:
    76             cmd = '%s -p "%s" --output output --add-setting-file imaker_variantdir.cfg' % (get_cmd(), project)
    76             cmd = '%s -p "%s" --output output --add-setting-file imaker_variantdir.cfg' % (get_cmd(), project)
    77             self.run_command(cmd)
    77             self.run_command(cmd)
    78             
    78             
    79             EXPECTED_DIR = os.path.join(ROOT_PATH, "testdata/generate/expected")
    79             EXPECTED_DIR = os.path.join(ROOT_PATH, "testdata/generate/expected")
    80             self.assert_dir_contents_equal('output', EXPECTED_DIR, ['.svn'])
    80             self.assert_dir_contents_equal(os.path.join(workdir,'output'), EXPECTED_DIR, ['.svn'])
    81         finally:
    81         finally:
    82             os.chdir(orig_workdir)
    82             os.chdir(orig_workdir)
    83 
    83 
    84 if __name__ == '__main__':
    84 if __name__ == '__main__':
    85       unittest.main()
    85       unittest.main()