Пример #1
0
    def test_submodules_include(
        self,
        checkout_submodules,
        checkout_path,
        tmpdir,
        value,
        expected,
    ):
        checkout_path.return_value = str(tmpdir)
        self.create_config_file(
            tmpdir,
            {
                'submodules': {
                    'include': value,
                },
            },
        )

        git_repo = make_git_repo(str(tmpdir))
        create_git_submodule(git_repo, 'one')
        create_git_submodule(git_repo, 'two')
        create_git_submodule(git_repo, 'three')

        update_docs = self.get_update_docs_task()
        checkout_path.return_value = git_repo
        update_docs.additional_vcs_operations()

        args, kwargs = checkout_submodules.call_args
        assert set(args[0]) == set(expected)
        assert update_docs.config.submodules.recursive is False
Пример #2
0
    def test_submodules_exclude_all(
        self,
        checkout_submodules,
        checkout_path,
        tmpdir,
    ):
        checkout_path.return_value = str(tmpdir)
        self.create_config_file(
            tmpdir,
            {
                'submodules': {
                    'exclude': ALL,
                    'recursive': True,
                },
            },
        )

        git_repo = make_git_repo(str(tmpdir))
        create_git_submodule(git_repo, 'one')
        create_git_submodule(git_repo, 'two')
        create_git_submodule(git_repo, 'three')

        update_docs = self.get_update_docs_task()
        checkout_path.return_value = git_repo
        update_docs.additional_vcs_operations()

        checkout_submodules.assert_not_called()
    def test_submodules_exclude(
        self,
        checkout_submodules,
        checkout_path,
        tmpdir,
    ):
        checkout_path.return_value = str(tmpdir)
        self.create_config_file(
            tmpdir,
            {
                'submodules': {
                    'exclude': ['one'],
                    'recursive': True,
                },
            },
        )

        git_repo = make_git_repo(str(tmpdir))
        create_git_submodule(git_repo, 'one')
        create_git_submodule(git_repo, 'two')
        create_git_submodule(git_repo, 'three')

        update_docs = self.get_update_docs_task()
        checkout_path.return_value = git_repo
        update_docs.additional_vcs_operations(update_docs.build_env)

        args, kwargs = checkout_submodules.call_args
        assert set(args[0]) == {'two', 'three'}
        assert update_docs.config.submodules.recursive is True
    def test_submodules_exclude_all(
        self, checkout_submodules,
        checkout_path, tmpdir,
    ):
        checkout_path.return_value = str(tmpdir)
        self.create_config_file(
            tmpdir,
            {
                'submodules': {
                    'exclude': ALL,
                    'recursive': True,
                },
            },
        )

        git_repo = make_git_repo(str(tmpdir))
        create_git_submodule(git_repo, 'one')
        create_git_submodule(git_repo, 'two')
        create_git_submodule(git_repo, 'three')

        update_docs = self.get_update_docs_task()
        checkout_path.return_value = git_repo
        update_docs.additional_vcs_operations()

        checkout_submodules.assert_not_called()
    def test_submodules_exclude(
        self, checkout_submodules,
        checkout_path, tmpdir,
    ):
        checkout_path.return_value = str(tmpdir)
        self.create_config_file(
            tmpdir,
            {
                'submodules': {
                    'exclude': ['one'],
                    'recursive': True,
                },
            },
        )

        git_repo = make_git_repo(str(tmpdir))
        create_git_submodule(git_repo, 'one')
        create_git_submodule(git_repo, 'two')
        create_git_submodule(git_repo, 'three')

        update_docs = self.get_update_docs_task()
        checkout_path.return_value = git_repo
        update_docs.additional_vcs_operations()

        args, kwargs = checkout_submodules.call_args
        assert set(args[0]) == {'two', 'three'}
        assert update_docs.config.submodules.recursive is True
Пример #6
0
    def test_submodules_default_exclude_all(
        self, checkout_submodules,
        checkout_path, tmpdir,
    ):

        checkout_path.return_value = str(tmpdir)
        self.create_config_file(
            tmpdir,
            {},
        )

        git_repo = make_git_repo(str(tmpdir))
        create_git_submodule(git_repo, 'one')
        create_git_submodule(git_repo, 'two')
        create_git_submodule(git_repo, 'three')

        update_docs = self.get_update_docs_task()
        checkout_path.return_value = git_repo
        update_docs.additional_vcs_operations(update_docs.build_env)

        checkout_submodules.assert_not_called()