test_targetconfigure.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:edi 作者: lueschem 项目源码 文件源码
def test_target_configure(config_files, monkeypatch, capsys):
    def fakerun(*popenargs, **kwargs):
        if get_command(popenargs) == "ansible-playbook":
            return subprocess.CompletedProcess("fakerun", 0, '')
        else:
            print('Passthrough: {}'.format(get_command(popenargs)))
            return subprocess.run(*popenargs, **kwargs)

    monkeypatch.setattr(mockablerun, 'run_mockable', fakerun)

    suppress_chown_during_debuild(monkeypatch)

    with workspace():
        edi_exec = os.path.join(get_project_root(), 'bin', 'edi')
        project_name = 'pytest-{}'.format(get_random_string(6))
        config_command = [edi_exec, 'config', 'init', project_name, 'debian-jessie-amd64']
        run(config_command)  # run as non root

        parser = edi._setup_command_line_interface()
        cli_args = parser.parse_args(['target', 'configure', 'remote-target', '{}-develop.yml'.format(project_name)])

        Configure().run_cli(cli_args)

        out, err = capsys.readouterr()
        print(out)
        assert not err
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号