本文整理匯總了Python中_pytest.config.Conftest.getconftestmodules方法的典型用法代碼示例。如果您正苦於以下問題:Python Conftest.getconftestmodules方法的具體用法?Python Conftest.getconftestmodules怎麽用?Python Conftest.getconftestmodules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類_pytest.config.Conftest
的用法示例。
在下文中一共展示了Conftest.getconftestmodules方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_setinitial_confcut
# 需要導入模塊: from _pytest.config import Conftest [as 別名]
# 或者: from _pytest.config.Conftest import getconftestmodules [as 別名]
def test_setinitial_confcut(testdir):
conf = testdir.makeconftest("")
sub = testdir.mkdir("sub")
sub.chdir()
for opts in (["--confcutdir=%s" % sub, sub],
[sub, "--confcutdir=%s" % sub],
["--confcutdir=.", sub],
[sub, "--confcutdir", sub],
[str(sub), "--confcutdir", "."],
):
conftest = Conftest()
conftest.setinitial(opts)
assert conftest._confcutdir == sub
assert conftest.getconftestmodules(sub) == []
assert conftest.getconftestmodules(conf.dirpath()) == []
示例2: test_conftestcutdir_inplace_considered
# 需要導入模塊: from _pytest.config import Conftest [as 別名]
# 或者: from _pytest.config.Conftest import getconftestmodules [as 別名]
def test_conftestcutdir_inplace_considered(testdir):
conf = testdir.makeconftest("")
conftest = Conftest(confcutdir=conf.dirpath())
conftest.setinitial([conf.dirpath()])
l = conftest.getconftestmodules(conf.dirpath())
assert len(l) == 1
assert l[0].__file__.startswith(str(conf))
示例3: test_doubledash_not_considered
# 需要導入模塊: from _pytest.config import Conftest [as 別名]
# 或者: from _pytest.config.Conftest import getconftestmodules [as 別名]
def test_doubledash_not_considered(testdir):
conf = testdir.mkdir("--option")
conf.join("conftest.py").ensure()
conftest = Conftest()
conftest.setinitial([conf.basename, conf.basename])
l = conftest.getconftestmodules(None)
assert len(l) == 0
示例4: test_conftestcutdir
# 需要導入模塊: from _pytest.config import Conftest [as 別名]
# 或者: from _pytest.config.Conftest import getconftestmodules [as 別名]
def test_conftestcutdir(testdir):
conf = testdir.makeconftest("")
p = testdir.mkdir("x")
conftest = Conftest(confcutdir=p)
conftest.setinitial([testdir.tmpdir])
l = conftest.getconftestmodules(p)
assert len(l) == 0
l = conftest.getconftestmodules(conf.dirpath())
assert len(l) == 0
assert conf not in conftest._conftestpath2mod
# but we can still import a conftest directly
conftest.importconftest(conf)
l = conftest.getconftestmodules(conf.dirpath())
assert l[0].__file__.startswith(str(conf))
# and all sub paths get updated properly
l = conftest.getconftestmodules(p)
assert len(l) == 1
assert l[0].__file__.startswith(str(conf))
示例5: test_conftest_import_order
# 需要導入模塊: from _pytest.config import Conftest [as 別名]
# 或者: from _pytest.config.Conftest 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 = Conftest()
monkeypatch.setattr(conftest, 'importconftest', impct)
assert conftest.getconftestmodules(sub) == [ct1, ct2]
示例6: test_immediate_initialiation_and_incremental_are_the_same
# 需要導入模塊: from _pytest.config import Conftest [as 別名]
# 或者: from _pytest.config.Conftest import getconftestmodules [as 別名]
def test_immediate_initialiation_and_incremental_are_the_same(self, basedir):
conftest = Conftest()
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