Пример #1
0
    def test_get_unknown_languages(self):
        project = Project.from_file(Path(get_test_path('project') / 'good_project.yaml'))

        assert project.get_unknown_languages() is None

        project = Project.from_file(Path(get_test_path('project') / 'good_project_unknown_language.yaml'))

        assert project.get_unknown_languages() == ['python']
Пример #2
0
    def test_has_unknown_languages(self):
        project = Project.from_file(Path(get_test_path('project') / 'good_project.yaml'))

        assert project.has_unknown_languages() is False

        project = Project.from_file(Path(get_test_path('project') / 'good_project_unknown_language.yaml'))

        assert project.has_unknown_languages() is True
Пример #3
0
    def test_get_module_set(self):
        project = Project.from_file(Path(get_test_path('project') / 'good_project.yaml'))

        assert isinstance(project.get_module_set(), ModuleSet)

        project = Project.from_file(Path(get_test_path('project') / 'good_project_unknown_language.yaml'))

        assert project.get_module_set() is None
Пример #4
0
    def test_create_project_from_bad_file(self):
        file = get_test_path('project') / 'bad_project.yaml'

        with pytest.raises(ValueError) as info:
            Project.from_file(file)

        assert info.value.args[0] == "Bad project file format: #/info/name violates the \"pattern\" constraint: it " \
                                     "does not match the '[a-zA-Z0-9-_]+' pattern."
Пример #5
0
    def test_prefetch_module_set(self):
        project = Project.from_file(Path(get_test_path('project') / 'good_project_unknown_language.yaml'))

        assert project._info['languages'] == ['java', 'python']
        assert project._module_set is None
        assert project._unknown_languages == ['python']

        project = Project.from_file(Path(get_test_path('project') / 'good_project.yaml'))

        assert project._info['languages'] == ['java']
        assert isinstance(project._module_set, ModuleSet)
        assert project._unknown_languages is None
Пример #6
0
 def test_create_project_from_good_file(self):
     file = get_test_path('project') / 'good_project.yaml'
     project = Project.from_file(file)
     # noinspection PyProtectedMember
     assert project._content == {
         'info': {
             'name': 'test-project',
             'title': 'A Glorious Implementation',
             'version': '1.0.1',
             'languages': ['java']
         },
         'vars': {'n1': 'v1'}
     }
Пример #7
0
    def test_get_dependencies(self):
        project = Project.from_file(Path(get_test_path('project') / 'good_project.yaml'))

        assert isinstance(project.get_dependencies(), DependencySet)