コード例 #1
0
    def test_load_from_file_raises_exception_if_file_not_found(self, read):
        def side_effect():
            raise FileNotFoundError

        read.side_effect = side_effect
        setup = Setup()
        with self.assertRaises(ConfigFileError):
            setup.load_from_file('/dummy/path')
コード例 #2
0
    def test_load_from_file_raises_exception_if_file_is_directory(self, read):
        def side_effect():
            raise IsADirectoryError

        read.side_effect = side_effect
        setup = Setup()
        with self.assertRaises(ConfigFileError) as ctx:
            setup.load_from_file('/dummy/path')
コード例 #3
0
    def test_load_from_file_raises_exception_on_yaml_scan_error(self, read, load):
        def side_effect(content):
            raise ScannerError

        load.side_effect = side_effect
        setup = Setup()
        with self.assertRaises(ConfigFileError) as ctx:
            setup.load_from_file('/dummy/path')
コード例 #4
0
 def test_load_from_file_adds_built_in_if_binary_not_found(
         self, read, load):
     setup = Setup()
     setup.load_from_file('dummy/path')
     self.assertIn('built-ins', setup._setup)
     self.assertIn('dummy_built_in', setup._setup['built-ins'])