remove config.getinitialnodes() method that was only used for testing method after the refactoring.
--HG-- branch : trunk
This commit is contained in:
parent
29051458fc
commit
f6da7ea0a5
|
@ -664,7 +664,8 @@ class FuncargRequest:
|
|||
def showfuncargs(config):
|
||||
from py._test.session import Collection
|
||||
collection = Collection(config)
|
||||
colitem = collection.getinitialnodes()[0]
|
||||
firstid = collection._normalizearg(config.args[0])
|
||||
colitem = collection.getbyid(firstid)[0]
|
||||
curdir = py.path.local()
|
||||
tw = py.io.TerminalWriter()
|
||||
plugins = getplugins(colitem, withpy=True)
|
||||
|
|
|
@ -160,13 +160,6 @@ class Collection:
|
|||
matching = l
|
||||
return matching
|
||||
|
||||
def getinitialnodes(self):
|
||||
idlist = [self._normalizearg(arg) for arg in self.config.args]
|
||||
nodes = []
|
||||
for id in idlist:
|
||||
nodes.extend(self.getbyid(id))
|
||||
return nodes
|
||||
|
||||
def perform_collect(self):
|
||||
nodes = []
|
||||
for arg in self.config.args:
|
||||
|
|
|
@ -1127,3 +1127,10 @@ class TestReportInfo:
|
|||
pass
|
||||
"""
|
||||
|
||||
def test_show_funcarg(testdir):
|
||||
result = testdir.runpytest("--funcargs")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*tmpdir*",
|
||||
"*temporary directory*",
|
||||
]
|
||||
)
|
||||
|
|
|
@ -517,14 +517,6 @@ def test_trace_reporting(testdir):
|
|||
])
|
||||
assert result.ret == 0
|
||||
|
||||
def test_show_funcarg(testdir, option):
|
||||
args = option.args + ["--funcargs"]
|
||||
result = testdir.runpytest(*args)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*tmpdir*",
|
||||
"*temporary directory*",
|
||||
]
|
||||
)
|
||||
|
||||
class TestGenericReporting:
|
||||
""" this test class can be subclassed with a different option
|
||||
|
|
|
@ -198,40 +198,37 @@ class Test_gettopdir:
|
|||
assert gettopdir(["%s::xyc::abc" % c]) == a
|
||||
assert gettopdir(["%s::xyc" % c, "%s::abc" % Z]) == tmp
|
||||
|
||||
def getargnode(collection, arg):
|
||||
return collection.getbyid(collection._normalizearg(str(arg)))[0]
|
||||
|
||||
class Test_getinitialnodes:
|
||||
def test_onedir(self, testdir):
|
||||
config = testdir.reparseconfig([testdir.tmpdir])
|
||||
colitems = Collection(config).getinitialnodes()
|
||||
assert len(colitems) == 1
|
||||
col = colitems[0]
|
||||
c = Collection(config)
|
||||
col = getargnode(c, testdir.tmpdir)
|
||||
assert isinstance(col, py.test.collect.Directory)
|
||||
for col in col.listchain():
|
||||
assert col.config is config
|
||||
|
||||
def test_twodirs(self, testdir, tmpdir):
|
||||
config = testdir.reparseconfig([tmpdir, tmpdir])
|
||||
colitems = Collection(config).getinitialnodes()
|
||||
assert len(colitems) == 2
|
||||
col1, col2 = colitems
|
||||
assert col1.name == col2.name
|
||||
assert col1.parent == col2.parent
|
||||
t2 = getargnode(c, testdir.tmpdir)
|
||||
assert col == t2
|
||||
|
||||
def test_curdir_and_subdir(self, testdir, tmpdir):
|
||||
a = tmpdir.ensure("a", dir=1)
|
||||
config = testdir.reparseconfig([tmpdir, a])
|
||||
colitems = Collection(config).getinitialnodes()
|
||||
assert len(colitems) == 2
|
||||
col1, col2 = colitems
|
||||
c = Collection(config)
|
||||
|
||||
col1 = getargnode(c, tmpdir)
|
||||
col2 = getargnode(c, a)
|
||||
assert col1.name == tmpdir.basename
|
||||
assert col2.name == 'a'
|
||||
for col in colitems:
|
||||
for col in (col1, col2):
|
||||
for subcol in col.listchain():
|
||||
assert col.config is config
|
||||
|
||||
def test_global_file(self, testdir, tmpdir):
|
||||
x = tmpdir.ensure("x.py")
|
||||
config = testdir.reparseconfig([x])
|
||||
col, = Collection(config).getinitialnodes()
|
||||
col = getargnode(Collection(config), x)
|
||||
assert isinstance(col, py.test.collect.Module)
|
||||
assert col.name == 'x.py'
|
||||
assert col.parent.name == tmpdir.basename
|
||||
|
@ -242,7 +239,7 @@ class Test_getinitialnodes:
|
|||
def test_global_dir(self, testdir, tmpdir):
|
||||
x = tmpdir.ensure("a", dir=1)
|
||||
config = testdir.reparseconfig([x])
|
||||
col, = Collection(config).getinitialnodes()
|
||||
col = getargnode(Collection(config), x)
|
||||
assert isinstance(col, py.test.collect.Directory)
|
||||
print(col.listchain())
|
||||
assert col.name == 'a'
|
||||
|
@ -254,7 +251,7 @@ class Test_getinitialnodes:
|
|||
x = tmpdir.ensure("x.py")
|
||||
tmpdir.ensure("__init__.py")
|
||||
config = testdir.reparseconfig([x])
|
||||
col, = Collection(config).getinitialnodes()
|
||||
col = getargnode(Collection(config), x)
|
||||
assert isinstance(col, py.test.collect.Module)
|
||||
assert col.name == 'x.py'
|
||||
assert col.parent.name == x.dirpath().basename
|
||||
|
|
Loading…
Reference in New Issue