예제 #1
0
    def run_exe_test(self, exe_name, exp_filename=None):
        """Run C exe and compare output xlsx file with the Excel file."""

        # Create the executable command
        if sys.platform == 'win32':
            command = r'cd test\functional\src && %s.exe' % exe_name
        else:
            command = 'cd test/functional/src && ./%s' % exe_name

        # Run the C executable to generate the "got" xlsx file.
        got = os.system(command)
        self.assertEqual(got, self.no_system_error)

        # Create the path/file names for the xlsx/xlsm files to compare.
        if exp_filename and exp_filename.endswith('.xlsm'):
            got_filename = exe_name.replace('test_', '') + '.xlsm'
        else:
            got_filename = exe_name.replace('test_', '') + '.xlsx'

        if not exp_filename:
            exp_filename = got_filename

        self.got_filename = 'test/functional/src/test_' + got_filename
        self.exp_filename = 'test/functional/xlsx_files/' + exp_filename

        # Do the comparison between the files.
        got, exp = _compare_xlsx_files(self.got_filename,
                                       self.exp_filename,
                                       self.ignore_files,
                                       self.ignore_elements)
        self.assertEqual(exp, got)
예제 #2
0
    def run_lua_test(self, lua_name, exp_filename=None):
        """Run lua test and compare output xlsx file with the Excel file."""

        got = os.system("lua test/comparison/lua/%s.lua" % lua_name)
        self.assertEqual(got, self.no_system_error)

        # Create the path/file names for the xlsx files to compare.
        got_filename = lua_name + '.xlsx'
        if not exp_filename:
            exp_filename = lua_name.replace('test_', '') + '.xlsx'

        self.got_filename = got_filename
        self.exp_filename = 'test/comparison/xlsx_files/' + exp_filename

        # Do the comparison between the files.
        got, exp = _compare_xlsx_files(self.got_filename, self.exp_filename,
                                       self.ignore_files, self.ignore_elements)
        self.assertEqual(got, exp)
예제 #3
0
    def run_exe_test(self, exe_name, exp_filename=None):
        """Run C exe and compare output xlsx file with the Excel file."""

        # Run the C executable to generate the "got" xlsx file.
        got = os.system("cd test/functional/src; ./%s" % exe_name)
        self.assertEqual(got, self.no_system_error)

        # Create the path/file names for the xlsx files to compare.
        got_filename = exe_name.replace('test_', '') + '.xlsx'

        if not exp_filename:
            exp_filename = got_filename

        self.got_filename = 'test/functional/src/test_' + got_filename
        self.exp_filename = 'test/functional/xlsx_files/' + exp_filename

        # Do the comparison between the files.
        got, exp = _compare_xlsx_files(self.got_filename, self.exp_filename,
                                       self.ignore_files, self.ignore_elements)
        self.assertEqual(got, exp)
예제 #4
0
    def run_lua_test(self, lua_name, exp_filename=None):
        """Run lua test and compare output xlsx file with the Excel file."""

        got = os.system("lua test/comparison/lua/%s.lua" % lua_name)
        self.assertEqual(got, self.no_system_error)

        # Create the path/file names for the xlsx files to compare.
        got_filename = lua_name + '.xlsx'
        if not exp_filename:
            exp_filename = lua_name.replace('test_', '') + '.xlsx'

        self.got_filename = got_filename
        self.exp_filename = 'test/comparison/xlsx_files/' + exp_filename

        # Do the comparison between the files.
        got, exp = _compare_xlsx_files(self.got_filename,
                                       self.exp_filename,
                                       self.ignore_files,
                                       self.ignore_elements)
        self.assertEqual(got, exp)
예제 #5
0
    def run_exe_test(self, exe_name, got_filename=None):
        """Run C exe and compare output xlsx file with the Excel file."""

        # Run the C executable to generate the "got" xlsx file.
        got = os.system("cd test/functional/src; ./%s" % exe_name)
        self.assertEqual(got, self.no_system_error)

        # Create the path/file names for the xlsx files to compare.
        exp_filename = exe_name.replace('test_', '') + '.xlsx'

        if not got_filename:
            got_filename = exp_filename

        self.got_filename = 'test/functional/src/test_' + got_filename
        self.exp_filename = 'test/functional/xlsx_files/' + exp_filename

        # Do the comparison between the files.
        got, exp = _compare_xlsx_files(self.got_filename,
                                       self.exp_filename,
                                       self.ignore_files,
                                       self.ignore_elements)
        self.assertEqual(got, exp)
예제 #6
0
    def run_exe_test(self, exe_name, exp_filename=None):
        """Run C exe and compare output xlsx file with the Excel file."""

        data_dir = pytest.config.getoption('data_dir')
        exec_dir = pytest.config.getoption('exec_dir')

        # Run the C executable to generate the "got" xlsx file.
        got = os.system("cd %s; ./%s" % (exec_dir, exe_name))
        self.assertEqual(got, self.no_system_error)

        # Create the path/file names for the xlsx files to compare.
        got_filename = exe_name.replace('test_', '') + '.xlsx'

        if not exp_filename:
            exp_filename = got_filename

        self.got_filename = os.path.join(exec_dir, 'test_' + got_filename)
        self.exp_filename = os.path.join(data_dir, exp_filename)

        # Do the comparison between the files.
        got, exp = _compare_xlsx_files(self.got_filename, self.exp_filename,
                                       self.ignore_files, self.ignore_elements)

        self.assertEqual(got, exp)