本文整理汇总了Python中_pytest.config.PytestPluginManager._getconftestmodules方法的典型用法代码示例。如果您正苦于以下问题:Python PytestPluginManager._getconftestmodules方法的具体用法?Python PytestPluginManager._getconftestmodules怎么用?Python PytestPluginManager._getconftestmodules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_pytest.config.PytestPluginManager
的用法示例。
在下文中一共展示了PytestPluginManager._getconftestmodules方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_doubledash_considered
# 需要导入模块: from _pytest.config import PytestPluginManager [as 别名]
# 或者: from _pytest.config.PytestPluginManager import _getconftestmodules [as 别名]
def test_doubledash_considered(testdir):
conf = testdir.mkdir("--option")
conf.ensure("conftest.py")
conftest = PytestPluginManager()
conftest_setinitial(conftest, [conf.basename, conf.basename])
values = conftest._getconftestmodules(conf)
assert len(values) == 1
示例2: test_conftestcutdir_inplace_considered
# 需要导入模块: from _pytest.config import PytestPluginManager [as 别名]
# 或者: from _pytest.config.PytestPluginManager import _getconftestmodules [as 别名]
def test_conftestcutdir_inplace_considered(testdir):
conf = testdir.makeconftest("")
conftest = PytestPluginManager()
conftest_setinitial(conftest, [conf.dirpath()], confcutdir=conf.dirpath())
values = conftest._getconftestmodules(conf.dirpath())
assert len(values) == 1
assert values[0].__file__.startswith(str(conf))
示例3: test_conftestcutdir
# 需要导入模块: from _pytest.config import PytestPluginManager [as 别名]
# 或者: from _pytest.config.PytestPluginManager import _getconftestmodules [as 别名]
def test_conftestcutdir(testdir):
conf = testdir.makeconftest("")
p = testdir.mkdir("x")
conftest = PytestPluginManager()
conftest_setinitial(conftest, [testdir.tmpdir], confcutdir=p)
values = conftest._getconftestmodules(p)
assert len(values) == 0
values = conftest._getconftestmodules(conf.dirpath())
assert len(values) == 0
assert conf not in conftest._conftestpath2mod
# but we can still import a conftest directly
conftest._importconftest(conf)
values = conftest._getconftestmodules(conf.dirpath())
assert values[0].__file__.startswith(str(conf))
# and all sub paths get updated properly
values = conftest._getconftestmodules(p)
assert len(values) == 1
assert values[0].__file__.startswith(str(conf))
示例4: test_conftest_import_order
# 需要导入模块: from _pytest.config import PytestPluginManager [as 别名]
# 或者: from _pytest.config.PytestPluginManager import _getconftestmodules [as 别名]
def test_conftest_import_order(testdir, monkeypatch):
ct1 = testdir.makeconftest("")
sub = testdir.mkdir("sub")
ct2 = sub.join("conftest.py")
ct2.write("")
def impct(p):
return p
conftest = PytestPluginManager()
monkeypatch.setattr(conftest, '_importconftest', impct)
assert conftest._getconftestmodules(sub) == [ct1, ct2]
示例5: test_immediate_initialiation_and_incremental_are_the_same
# 需要导入模块: from _pytest.config import PytestPluginManager [as 别名]
# 或者: from _pytest.config.PytestPluginManager import _getconftestmodules [as 别名]
def test_immediate_initialiation_and_incremental_are_the_same(self, basedir):
conftest = PytestPluginManager()
len(conftest._path2confmods)
conftest._getconftestmodules(basedir)
snap1 = len(conftest._path2confmods)
# assert len(conftest._path2confmods) == snap1 + 1
conftest._getconftestmodules(basedir.join("adir"))
assert len(conftest._path2confmods) == snap1 + 1
conftest._getconftestmodules(basedir.join("b"))
assert len(conftest._path2confmods) == snap1 + 2