Ejemplo n.º 1
0
    def testSanityCheckCollectionCalled(self, abspath, mockParse, mockWrite,
                                        mockSanity):
        """Tests that --check calls sanity check with collection"""

        abspath.return_value = 'file.flex'
        mockParse.return_value = self.ccc
        cdl2 = cdl_convert.ColorCorrection('45')
        cdl3 = cdl_convert.ColorCorrection('100')
        self.ccc.append_children([self.cdl, cdl2, cdl3])
        sys.argv = ['scriptname', 'file.flex', '--check']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        self.assertEqual(
            [mock.call(self.cdl),
             mock.call(cdl2),
             mock.call(cdl3)], mockSanity.call_args_list)

        self.assertEqual(
            [mock.call(self.cdl),
             mock.call(cdl2),
             mock.call(cdl3)], mockWrite.call_args_list)
Ejemplo n.º 2
0
    def testWriteCollectionCalled(self, abspath, mockParse, mockWrite):
        """Tests that we try and write a converted collection file"""

        abspath.return_value = 'file.cdl'
        mockParse.return_value = self.cdl
        sys.argv = ['scriptname', 'file.cdl', '-i', 'rcdl', '-o', 'ccc']

        mockInputs = dict(self.inputFormats)
        mockInputs['rcdl'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['ccc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        self.assertTrue(
            mockWrite.called
        )

        self.assertEqual(
            [self.cdl],
            mockWrite.call_args_list[0][0][0].all_children
        )
Ejemplo n.º 3
0
    def testNoOutputCollection(self, mockParse, mockWrite, mockDest,
                               mockPathExists):
        """Tests that we don't write a converted collection file"""

        mockPathExists.return_value = True

        self.mockMakeDirs.reset_mock()

        mockParse.return_value = self.cdl
        sys.argv = [
            'scriptname', 'file.cc', '-o', 'ccc', '-d', '/fakepath',
            '--no-output'
        ]

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['ccc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        # Because we have no output selected, a new directory should NOT
        # be created, but path exists should have still been called.
        mockPathExists.assert_called_with('/fakepath')
        self.assertFalse(self.mockMakeDirs.called)

        mockParse.assert_called_once_with(os.path.join(os.getcwd(), 'file.cc'))
        # Determine dest should have set a file_out
        mockDest.assert_called_once_with('/fakepath')
        # But the write should never have been called.
        self.assertFalse(mockWrite.called)
Ejemplo n.º 4
0
    def testSanityCheckCollectionCalled(
            self, abspath, mockParse, mockWrite, mockSanity
    ):
        """Tests that --check calls sanity check with collection"""

        abspath.return_value = 'file.flex'
        mockParse.return_value = self.ccc
        cdl2 = cdl_convert.ColorCorrection('45')
        cdl3 = cdl_convert.ColorCorrection('100')
        self.ccc.append_children([self.cdl, cdl2, cdl3])
        sys.argv = ['scriptname', 'file.flex', '--check']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        self.assertEqual(
            [mock.call(self.cdl), mock.call(cdl2), mock.call(cdl3)],
            mockSanity.call_args_list
        )

        self.assertEqual(
            [mock.call(self.cdl), mock.call(cdl2), mock.call(cdl3)],
            mockWrite.call_args_list
        )
Ejemplo n.º 5
0
    def testSingleCollectionExportCCC(self, mockParse, mockWrite):
        """Tests that with single export we export multiple times."""

        cc1 = cdl_convert.ColorCorrection(
            id='cc1', input_file='../cc1.cc'
        )
        cc2 = cdl_convert.ColorCorrection(
            id='cc2', input_file='../cc2.cc'
        )
        cc3 = cdl_convert.ColorCorrection(
            id='cc3', input_file='../cc3.cc'
        )
        self.ccc.append_children([cc1, cc2, cc3])
        mockParse.return_value = self.ccc

        sys.argv = ['scriptname', 'file.ccc', '-o', 'ccc', '--single']

        destination_dir = os.path.abspath('./converted/')

        mockInputs = dict(self.inputFormats)
        mockInputs['ccc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['ccc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        # Check that write was called three times, once for each child cc
        calls = [
            mock.call(cc1),
            mock.call(cc2),
            mock.call(cc3)
        ]
        try:
            mockWrite.assert_has_calls(calls)
        except AssertionError:
            self.fail("Was not given a call for every child cc!")

        # Check that after writing, our parent is still set to the original ccc
        self.assertEqual(
            cc1.parent,
            self.ccc
        )

        self.assertEqual(
            cc2.parent,
            self.ccc
        )

        self.assertEqual(
            cc3.parent,
            self.ccc
        )
Ejemplo n.º 6
0
    def testOverrideInputType(self, abspath, mockParse):
        """Tests that overriding the input type happens when provided"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.cc', '-i', 'flex']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        main.main()

        mockParse.assert_called_once_with('file.cc')
Ejemplo n.º 7
0
    def testDerivingInputTypeAle(self, abspath, mockParse):
        """Tests that input type will be derived from file extension"""

        abspath.return_value = 'file.ale'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.ale']

        mockInputs = dict(self.inputFormats)
        mockInputs['ale'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        main.main()

        mockParse.assert_called_once_with('file.ale')
Ejemplo n.º 8
0
    def testGettingAbsolutePath(self, abspath, mockParse):
        """Tests that we make sure to get the absolute path"""

        abspath.return_value = 'file.flex'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.flex']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        cdl_convert.INPUT_FORMATS = mockInputs

        cdl_convert.main()

        abspath.assert_called_once_with('file.flex')
Ejemplo n.º 9
0
    def testDerivingInputTypeCased(self, abspath, mockParse):
        """Tests that input type will be derived from file extension"""

        abspath.return_value = 'file.fLEx'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.fLEx']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        cdl_convert.INPUT_FORMATS = mockInputs

        cdl_convert.main()

        mockParse.assert_called_once_with('file.fLEx')
Ejemplo n.º 10
0
    def testDerivingInputTypeCased(self, abspath, mockParse):
        """Tests that input type will be derived from file extension"""

        abspath.return_value = 'file.fLEx'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.fLEx']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        main.main()

        mockParse.assert_called_once_with('file.fLEx')
Ejemplo n.º 11
0
    def testOverrideInputType(self, abspath, mockParse):
        """Tests that overriding the input type happens when provided"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.cc', '-i', 'flex']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        cdl_convert.INPUT_FORMATS = mockInputs

        cdl_convert.main()

        mockParse.assert_called_once_with('file.cc')
Ejemplo n.º 12
0
    def testCustomDestinationPath(self, abspath, mockParse):
        """Tests that we make sure to get the absolute path for dest"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.cc', '-d', '/best/path/ever/']

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        main.main()

        file_call = mock.call('file.cc')
        dest_call = mock.call('/best/path/ever/')

        abspath.assert_has_calls([file_call, dest_call])
Ejemplo n.º 13
0
    def testGettingAbsolutePath(self, abspath, mockParse):
        """Tests that we make sure to get the absolute path"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        main.main()

        file_call = mock.call('file.cc')
        dest_call = mock.call('./converted/')

        abspath.assert_has_calls([file_call, dest_call])
Ejemplo n.º 14
0
    def testGettingAbsolutePath(self, abspath, mockParse):
        """Tests that we make sure to get the absolute path"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        main.main()

        file_call = mock.call('file.cc')
        dest_call = mock.call('./converted/')

        abspath.assert_has_calls([file_call, dest_call])
Ejemplo n.º 15
0
    def testCustomDestinationPath(self, abspath, mockParse):
        """Tests that we make sure to get the absolute path for dest"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = None
        sys.argv = ['scriptname', 'file.cc', '-d', '/best/path/ever/']

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        main.main()

        file_call = mock.call('file.cc')
        dest_call = mock.call('/best/path/ever/')

        abspath.assert_has_calls([file_call, dest_call])
Ejemplo n.º 16
0
    def testSanityCheckCalled(self, abspath, mockParse, mockWrite, mockSanity):
        """Tests that --check calls sanity check"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = self.cdl
        sys.argv = ['scriptname', 'file.cc', '--check']

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        mockSanity.assert_called_once_with(self.cdl)
Ejemplo n.º 17
0
    def testWriteCalled(self, abspath, mockParse, mockWrite):
        """Tests that we try and write a converted file"""

        abspath.return_value = 'file.cdl'
        mockParse.return_value = self.cdl
        sys.argv = ['scriptname', 'file.cdl', '-i', 'rcdl', '-o', 'cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['rcdl'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        mockWrite.assert_called_once_with(self.cdl)
Ejemplo n.º 18
0
    def testWriteCalled(self, abspath, mockParse, mockWrite):
        """Tests that we try and write a converted file"""

        abspath.return_value = 'file.flex'
        mockParse.return_value = [self.cdl, ]
        sys.argv = ['scriptname', 'file.flex', '-o', 'cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        cdl_convert.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        cdl_convert.OUTPUT_FORMATS = mockOutputs

        cdl_convert.main()

        mockWrite.assert_called_once_with(self.cdl)
Ejemplo n.º 19
0
    def testSanityCheckCalled(self, abspath, mockParse, mockWrite, mockSanity):
        """Tests that --check calls sanity check"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = self.cdl
        sys.argv = ['scriptname', 'file.cc', '--check']

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        mockSanity.assert_called_once_with(self.cdl)
Ejemplo n.º 20
0
    def testSanityCheckNotCalled(self, abspath, mockParse, mockWrite,
                                 mockSanity):
        """Tests that sanity check is not called without --check"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = self.cdl
        sys.argv = ['scriptname', 'file.cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        self.assertFalse(mockSanity.called)
Ejemplo n.º 21
0
    def testNoOutputCollection(self, mockParse, mockWrite, mockDest, mockPathExists):
        """Tests that we don't write a converted collection file"""

        mockPathExists.return_value = True

        self.mockMakeDirs.reset_mock()

        mockParse.return_value = self.cdl
        sys.argv = [
            'scriptname',
            'file.cc',
            '-o',
            'ccc',
            '-d',
            '/fakepath',
            '--no-output'
        ]

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['ccc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        # Because we have no output selected, a new directory should NOT
        # be created, but path exists should have still been called.
        mockPathExists.assert_called_with('/fakepath')
        self.assertFalse(
            self.mockMakeDirs.called
        )

        mockParse.assert_called_once_with(os.path.join(os.getcwd(), 'file.cc'))
        # Determine dest should have set a file_out
        mockDest.assert_called_once_with('/fakepath')
        # But the write should never have been called.
        self.assertFalse(
            mockWrite.called
        )
Ejemplo n.º 22
0
    def testSanityCheckNotCalled(self, abspath, mockParse, mockWrite, mockSanity):
        """Tests that sanity check is not called without --check"""

        abspath.return_value = 'file.cc'
        mockParse.return_value = self.cdl
        sys.argv = ['scriptname', 'file.cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['cc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        self.assertFalse(
            mockSanity.called
        )
Ejemplo n.º 23
0
    def testDetermineDestCalledCollection(self, mockParse, mockWrite):
        """Tests that we try and write a converted collection file"""

        mockParse.return_value = self.ccc
        sys.argv = ['scriptname', 'file.flex', '-o', 'ccc']

        destination_dir = os.path.abspath('./converted/')

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['ccc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        self.assertEqual(os.path.join(destination_dir, 'testcdl.ccc'),
                         self.ccc.file_out)
Ejemplo n.º 24
0
    def testMultipleOutputWritesCalled(self, abspath, mockParse, mockWriteCC,
                                       mockWriteCDL):
        """Tests that we try and write a converted file"""

        abspath.return_value = 'file.ccc'
        mockParse.return_value.color_corrections = [self.cdl, ]
        sys.argv = ['scriptname', 'file.ccc', '-o', 'cc,rcdl']

        mockInputs = dict(self.inputFormats)
        mockInputs['ccc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWriteCC
        mockOutputs['rcdl'] = mockWriteCDL
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        mockWriteCC.assert_called_once_with(self.cdl)
        mockWriteCDL.assert_called_once_with(self.cdl)
Ejemplo n.º 25
0
    def testWriteCollectionCalled(self, abspath, mockParse, mockWrite):
        """Tests that we try and write a converted collection file"""

        abspath.return_value = 'file.cdl'
        mockParse.return_value = self.cdl
        sys.argv = ['scriptname', 'file.cdl', '-i', 'rcdl', '-o', 'ccc']

        mockInputs = dict(self.inputFormats)
        mockInputs['rcdl'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['ccc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        self.assertTrue(mockWrite.called)

        self.assertEqual([self.cdl],
                         mockWrite.call_args_list[0][0][0].all_children)
Ejemplo n.º 26
0
    def testDetermineDestCalledCollection(self, mockParse, mockWrite):
        """Tests that we try and write a converted collection file"""

        mockParse.return_value = self.ccc
        sys.argv = ['scriptname', 'file.flex', '-o', 'ccc']

        destination_dir = os.path.abspath('./converted/')

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['ccc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        self.assertEqual(
            os.path.join(destination_dir, 'testcdl.ccc'),
            self.ccc.file_out
        )
Ejemplo n.º 27
0
    def testDetermineDestCalled(self, abspath, mockParse, mockWrite, dirname):
        """Tests that we try and write a converted file"""

        abspath.return_value = 'file.flex'
        dirname.return_value = ''  # determine_dest method calls to get dirname
        mockParse.return_value = [self.cdl, ]
        sys.argv = ['scriptname', 'file.flex', '-o', 'cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['flex'] = mockParse
        cdl_convert.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWrite
        cdl_convert.OUTPUT_FORMATS = mockOutputs

        cdl_convert.main()

        self.assertEqual(
            'uniqueId.cc',
            self.cdl.file_out
        )
Ejemplo n.º 28
0
    def testMultipleOutputWritesCalled(self, abspath, mockParse, mockWriteCC,
                                       mockWriteCDL):
        """Tests that we try and write a converted file"""

        abspath.return_value = 'file.ccc'
        mockParse.return_value.color_corrections = [
            self.cdl,
        ]
        sys.argv = ['scriptname', 'file.ccc', '-o', 'cc,rcdl']

        mockInputs = dict(self.inputFormats)
        mockInputs['ccc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWriteCC
        mockOutputs['rcdl'] = mockWriteCDL
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        mockWriteCC.assert_called_once_with(self.cdl)
        mockWriteCDL.assert_called_once_with(self.cdl)
Ejemplo n.º 29
0
    def testMultipleWritesFromCollectionCalled(
            self, abspath, mockParse, mockWriteCC
    ):
        """Tests that we try and write a converted file"""

        abspath.return_value = 'file.ccc'
        mockParse.return_value.color_corrections = [
            self.cdl, self.cdl, self.cdl
        ]
        sys.argv = ['scriptname', 'file.ccc', '-o', 'cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['ccc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWriteCC
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        mockWriteCC.assert_has_calls(
            [mock.call(self.cdl), mock.call(self.cdl), mock.call(self.cdl)]
        )
Ejemplo n.º 30
0
    def testSingleCollectionExportCCC(self, mockParse, mockWrite):
        """Tests that with single export we export multiple times."""

        cc1 = cdl_convert.ColorCorrection(id='cc1', input_file='../cc1.cc')
        cc2 = cdl_convert.ColorCorrection(id='cc2', input_file='../cc2.cc')
        cc3 = cdl_convert.ColorCorrection(id='cc3', input_file='../cc3.cc')
        self.ccc.append_children([cc1, cc2, cc3])
        mockParse.return_value = self.ccc

        sys.argv = ['scriptname', 'file.ccc', '-o', 'ccc', '--single']

        destination_dir = os.path.abspath('./converted/')

        mockInputs = dict(self.inputFormats)
        mockInputs['ccc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['ccc'] = mockWrite
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        # Check that write was called three times, once for each child cc
        calls = [mock.call(cc1), mock.call(cc2), mock.call(cc3)]
        try:
            mockWrite.assert_has_calls(calls)
        except AssertionError:
            self.fail("Was not given a call for every child cc!")

        # Check that after writing, our parent is still set to the original ccc
        self.assertEqual(cc1.parent, self.ccc)

        self.assertEqual(cc2.parent, self.ccc)

        self.assertEqual(cc3.parent, self.ccc)
Ejemplo n.º 31
0
    def testMultipleWritesFromCollectionCalled(self, abspath, mockParse,
                                               mockWriteCC):
        """Tests that we try and write a converted file"""

        abspath.return_value = 'file.ccc'
        mockParse.return_value.color_corrections = [
            self.cdl, self.cdl, self.cdl
        ]
        sys.argv = ['scriptname', 'file.ccc', '-o', 'cc']

        mockInputs = dict(self.inputFormats)
        mockInputs['ccc'] = mockParse
        parse.INPUT_FORMATS = mockInputs

        mockOutputs = dict(self.outputFormats)
        mockOutputs['cc'] = mockWriteCC
        write.OUTPUT_FORMATS = mockOutputs

        main.main()

        mockWriteCC.assert_has_calls(
            [mock.call(self.cdl),
             mock.call(self.cdl),
             mock.call(self.cdl)])
Ejemplo n.º 32
0
# Standard Imports

import sys

# cdl_convert imports

from cdl_convert.cdl_convert import main

# ==============================================================================
# PRIVATE FUNCTIONS
# ==============================================================================


def _print_error(*objs):
    print(*objs, file=sys.stderr)


# ==============================================================================
# EXECUTION
# ==============================================================================

if __name__ == '__main__':  # pragma: no cover
    try:
        main()
    except Exception as err:  # pylint: disable=W0703
        import traceback
        _print_error('Unexpected error encountered:')
        _print_error(err)
        _print_error(traceback.format_exc())
        exit(1)