Exemple #1
0
    def _init_site(self):
        from nikola.plugins.command.init import CommandInit

        command_init = CommandInit()
        command_init.execute(options={'demo': True, 'quiet': True}, args=['demo'])

        sys.path.insert(0, '')
        os.chdir('demo')
        import conf
        _reload(conf)
        sys.path.pop(0)

        self._site = nikola.Nikola(**conf.__dict__)
        self._site.init_plugins()
Exemple #2
0
def init_command(tmpdir, ask_questions, copy_sample_site, create_configuration,
                 create_empty_site):
    with mock.patch("nikola.plugins.command.init.CommandInit.ask_questions",
                    ask_questions):
        with mock.patch(
                "nikola.plugins.command.init.CommandInit.copy_sample_site",
                copy_sample_site):
            with mock.patch(
                    "nikola.plugins.command.init.CommandInit.create_configuration",
                    create_configuration,
            ):
                with mock.patch(
                        "nikola.plugins.command.init.CommandInit.create_empty_site",
                        create_empty_site,
                ):
                    with cd(str(tmpdir)):
                        yield CommandInit()
    def _init_site(self, monkeypatch, tmp_path):
        from nikola.plugins.command.init import CommandInit

        monkeypatch.chdir(tmp_path)
        command_init = CommandInit()
        command_init.execute(options={
            'demo': True,
            'quiet': True
        },
                             args=['demo'])

        sys.path.insert(0, '')
        monkeypatch.chdir(tmp_path / 'demo')
        import conf  # noqa
        _reload(conf)
        sys.path.pop(0)

        self._site = nikola.Nikola(**conf.__dict__)
        self._site.init_plugins()