Exemple #1
0
    def test_loads_from_file_is_searching_in_rkd_path(self):
        """Assert that makefile.yml will be searched in RKD_PATH"""

        yaml_loader = YamlFileLoader([])

        d = tempfile.TemporaryDirectory()
        os.environ['RKD_PATH'] = d.name

        with open(d.name + '/makefile.yml', 'w') as f:
            f.write('''
version: org.riotkit.rkd/yaml/v1
imports: []
tasks: 
    :join:iwa-ait:
        description: Subscribe to any local section of IWA-AIT, workers have common interest
        arguments:
            - not a list
            ''')

        try:
            self.assertRaises(
                YAMLFileValidationError, lambda: yaml_loader.load_from_file(
                    'makefile.yml', 'org.riotkit.rkd/yaml/v1'))
        finally:
            d.cleanup()
            os.environ['RKD_PATH'] = ''
Exemple #2
0
    def test_invalid_file_path_is_causing_exception(self):
        """Test that invalid path will be reported quickly"""

        yaml_loader = YamlFileLoader([])
        self.assertRaises(
            FileNotFoundError, lambda: yaml_loader.load_from_file(
                'non-existing-file.yml', 'org.riotkit.rkd/yaml/v1'))