当前位置: 首页>>代码示例>>Python>>正文


Python config.Config类代码示例

本文整理汇总了Python中_pytest.config.Config的典型用法代码示例。如果您正苦于以下问题:Python Config类的具体用法?Python Config怎么用?Python Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Config类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_inifilename

    def test_inifilename(self, tmpdir):
        tmpdir.join("foo/bar.ini").ensure().write(_pytest._code.Source("""
            [pytest]
            name = value
        """))

        from _pytest.config import Config
        inifile = '../../foo/bar.ini'
        option_dict = {
            'inifilename': inifile,
            'capture': 'no',
        }

        cwd = tmpdir.join('a/b')
        cwd.join('pytest.ini').ensure().write(_pytest._code.Source("""
            [pytest]
            name = wrong-value
            should_not_be_set = true
        """))
        with cwd.ensure(dir=True).as_cwd():
            config = Config.fromdictargs(option_dict, ())

        assert config.args == [str(cwd)]
        assert config.option.inifilename == inifile
        assert config.option.capture == 'no'

        # this indicates this is the file used for getting configuration values
        assert config.inifile == inifile
        assert config.inicfg.get('name') == 'value'
        assert config.inicfg.get('should_not_be_set') is None
开发者ID:RonnyPfannschmidt,项目名称:pytest,代码行数:30,代码来源:test_config.py

示例2: remote_initconfig

def remote_initconfig(option_dict, args):
    from _pytest.config import Config
    option_dict['plugins'].append("no:terminal")
    config = Config.fromdictargs(option_dict, args)
    config.option.appliances = []
    config.args = args
    return config
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:7,代码来源:remote.py

示例3: test_origargs

    def test_origargs(self):
        """Show that fromdictargs can handle args in their "orig" format"""
        from _pytest.config import Config
        option_dict = {}
        args = ['-vvvv', '-s', 'a', 'b']

        config = Config.fromdictargs(option_dict, args)
        assert config.args == ['a', 'b']
        assert config._origargs == args
        assert config.option.verbose == 4
        assert config.option.capture == 'no'
开发者ID:RonnyPfannschmidt,项目名称:pytest,代码行数:11,代码来源:test_config.py

示例4: remote_initconfig

def remote_initconfig(option_dict, args):
    from _pytest.config import Config
    option_dict['plugins'].append("no:terminal")
    config = Config.fromdictargs(option_dict, args)
    config.option.looponfail = False
    config.option.usepdb = False
    config.option.dist = "no"
    config.option.distload = False
    config.option.numprocesses = None
    config.args = args
    return config
开发者ID:epeden,项目名称:pytest-xdist,代码行数:11,代码来源:remote.py

示例5: test_basic_behavior

    def test_basic_behavior(self):
        from _pytest.config import Config

        option_dict = {"verbose": 444, "foo": "bar", "capture": "no"}
        args = ["a", "b"]

        config = Config.fromdictargs(option_dict, args)
        with pytest.raises(AssertionError):
            config.parse(["should refuse to parse again"])
        assert config.option.verbose == 444
        assert config.option.foo == "bar"
        assert config.option.capture == "no"
        assert config.args == args
开发者ID:kalekundert,项目名称:pytest,代码行数:13,代码来源:test_config.py

示例6: test_basic_behavior

    def test_basic_behavior(self):
        from _pytest.config import Config
        option_dict = {
            'verbose': 444,
            'foo': 'bar',
            'capture': 'no',
        }
        args = ['a', 'b']

        config = Config.fromdictargs(option_dict, args)
        with pytest.raises(AssertionError):
            config.parse(['should refuse to parse again'])
        assert config.option.verbose == 444
        assert config.option.foo == 'bar'
        assert config.option.capture == 'no'
        assert config.args == args
开发者ID:RonnyPfannschmidt,项目名称:pytest,代码行数:16,代码来源:test_config.py

示例7: init_slave_session

def init_slave_session(channel, args, option_dict):
    import os, sys
    outchannel = channel.gateway.newchannel()
    sys.stdout = sys.stderr = outchannel.makefile('w')
    channel.send(outchannel)
    # prune sys.path to not contain relative paths
    newpaths = []
    for p in sys.path:
        if p:
            if not os.path.isabs(p):
                p = os.path.abspath(p)
            newpaths.append(p)
    sys.path[:] = newpaths

    #fullwidth, hasmarkup = channel.receive()
    from _pytest.config import Config
    config = Config.fromdictargs(option_dict, list(args))
    config.args = args
    from xdist.looponfail import SlaveFailSession
    SlaveFailSession(config, channel).main()
开发者ID:rdebliek,项目名称:oscar,代码行数:20,代码来源:looponfail.py

示例8: test_inifilename

    def test_inifilename(self, tmpdir):
        tmpdir.join("foo/bar.ini").ensure().write(
            _pytest._code.Source(
                """
            [pytest]
            name = value
        """
            )
        )

        from _pytest.config import Config

        inifile = "../../foo/bar.ini"
        option_dict = {"inifilename": inifile, "capture": "no"}

        cwd = tmpdir.join("a/b")
        cwd.join("pytest.ini").ensure().write(
            _pytest._code.Source(
                """
            [pytest]
            name = wrong-value
            should_not_be_set = true
        """
            )
        )
        with cwd.ensure(dir=True).as_cwd():
            config = Config.fromdictargs(option_dict, ())

        assert config.args == [str(cwd)]
        assert config.option.inifilename == inifile
        assert config.option.capture == "no"

        # this indicates this is the file used for getting configuration values
        assert config.inifile == inifile
        assert config.inicfg.get("name") == "value"
        assert config.inicfg.get("should_not_be_set") is None
开发者ID:kalekundert,项目名称:pytest,代码行数:36,代码来源:test_config.py

示例9: pytest_configure

def pytest_configure(config: Config):
    if config.getoption('--report-surefire'):
        plugin = SurefireRESTReporter(config)
        config.pluginmanager.register(plugin, 'surefirereporter')
开发者ID:Scalr,项目名称:revizor-tests,代码行数:4,代码来源:surefire.py


注:本文中的_pytest.config.Config类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。