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):
|
def showfuncargs(config):
|
||||||
from py._test.session import Collection
|
from py._test.session import Collection
|
||||||
collection = Collection(config)
|
collection = Collection(config)
|
||||||
colitem = collection.getinitialnodes()[0]
|
firstid = collection._normalizearg(config.args[0])
|
||||||
|
colitem = collection.getbyid(firstid)[0]
|
||||||
curdir = py.path.local()
|
curdir = py.path.local()
|
||||||
tw = py.io.TerminalWriter()
|
tw = py.io.TerminalWriter()
|
||||||
plugins = getplugins(colitem, withpy=True)
|
plugins = getplugins(colitem, withpy=True)
|
||||||
|
|
|
@ -160,13 +160,6 @@ class Collection:
|
||||||
matching = l
|
matching = l
|
||||||
return matching
|
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):
|
def perform_collect(self):
|
||||||
nodes = []
|
nodes = []
|
||||||
for arg in self.config.args:
|
for arg in self.config.args:
|
||||||
|
|
|
@ -1127,3 +1127,10 @@ class TestReportInfo:
|
||||||
pass
|
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
|
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:
|
class TestGenericReporting:
|
||||||
""" this test class can be subclassed with a different option
|
""" 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::abc" % c]) == a
|
||||||
assert gettopdir(["%s::xyc" % c, "%s::abc" % Z]) == tmp
|
assert gettopdir(["%s::xyc" % c, "%s::abc" % Z]) == tmp
|
||||||
|
|
||||||
|
def getargnode(collection, arg):
|
||||||
|
return collection.getbyid(collection._normalizearg(str(arg)))[0]
|
||||||
|
|
||||||
class Test_getinitialnodes:
|
class Test_getinitialnodes:
|
||||||
def test_onedir(self, testdir):
|
def test_onedir(self, testdir):
|
||||||
config = testdir.reparseconfig([testdir.tmpdir])
|
config = testdir.reparseconfig([testdir.tmpdir])
|
||||||
colitems = Collection(config).getinitialnodes()
|
c = Collection(config)
|
||||||
assert len(colitems) == 1
|
col = getargnode(c, testdir.tmpdir)
|
||||||
col = colitems[0]
|
|
||||||
assert isinstance(col, py.test.collect.Directory)
|
assert isinstance(col, py.test.collect.Directory)
|
||||||
for col in col.listchain():
|
for col in col.listchain():
|
||||||
assert col.config is config
|
assert col.config is config
|
||||||
|
t2 = getargnode(c, testdir.tmpdir)
|
||||||
def test_twodirs(self, testdir, tmpdir):
|
assert col == t2
|
||||||
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
|
|
||||||
|
|
||||||
def test_curdir_and_subdir(self, testdir, tmpdir):
|
def test_curdir_and_subdir(self, testdir, tmpdir):
|
||||||
a = tmpdir.ensure("a", dir=1)
|
a = tmpdir.ensure("a", dir=1)
|
||||||
config = testdir.reparseconfig([tmpdir, a])
|
config = testdir.reparseconfig([tmpdir, a])
|
||||||
colitems = Collection(config).getinitialnodes()
|
c = Collection(config)
|
||||||
assert len(colitems) == 2
|
|
||||||
col1, col2 = colitems
|
col1 = getargnode(c, tmpdir)
|
||||||
|
col2 = getargnode(c, a)
|
||||||
assert col1.name == tmpdir.basename
|
assert col1.name == tmpdir.basename
|
||||||
assert col2.name == 'a'
|
assert col2.name == 'a'
|
||||||
for col in colitems:
|
for col in (col1, col2):
|
||||||
for subcol in col.listchain():
|
for subcol in col.listchain():
|
||||||
assert col.config is config
|
assert col.config is config
|
||||||
|
|
||||||
def test_global_file(self, testdir, tmpdir):
|
def test_global_file(self, testdir, tmpdir):
|
||||||
x = tmpdir.ensure("x.py")
|
x = tmpdir.ensure("x.py")
|
||||||
config = testdir.reparseconfig([x])
|
config = testdir.reparseconfig([x])
|
||||||
col, = Collection(config).getinitialnodes()
|
col = getargnode(Collection(config), x)
|
||||||
assert isinstance(col, py.test.collect.Module)
|
assert isinstance(col, py.test.collect.Module)
|
||||||
assert col.name == 'x.py'
|
assert col.name == 'x.py'
|
||||||
assert col.parent.name == tmpdir.basename
|
assert col.parent.name == tmpdir.basename
|
||||||
|
@ -242,7 +239,7 @@ class Test_getinitialnodes:
|
||||||
def test_global_dir(self, testdir, tmpdir):
|
def test_global_dir(self, testdir, tmpdir):
|
||||||
x = tmpdir.ensure("a", dir=1)
|
x = tmpdir.ensure("a", dir=1)
|
||||||
config = testdir.reparseconfig([x])
|
config = testdir.reparseconfig([x])
|
||||||
col, = Collection(config).getinitialnodes()
|
col = getargnode(Collection(config), x)
|
||||||
assert isinstance(col, py.test.collect.Directory)
|
assert isinstance(col, py.test.collect.Directory)
|
||||||
print(col.listchain())
|
print(col.listchain())
|
||||||
assert col.name == 'a'
|
assert col.name == 'a'
|
||||||
|
@ -254,7 +251,7 @@ class Test_getinitialnodes:
|
||||||
x = tmpdir.ensure("x.py")
|
x = tmpdir.ensure("x.py")
|
||||||
tmpdir.ensure("__init__.py")
|
tmpdir.ensure("__init__.py")
|
||||||
config = testdir.reparseconfig([x])
|
config = testdir.reparseconfig([x])
|
||||||
col, = Collection(config).getinitialnodes()
|
col = getargnode(Collection(config), x)
|
||||||
assert isinstance(col, py.test.collect.Module)
|
assert isinstance(col, py.test.collect.Module)
|
||||||
assert col.name == 'x.py'
|
assert col.name == 'x.py'
|
||||||
assert col.parent.name == x.dirpath().basename
|
assert col.parent.name == x.dirpath().basename
|
||||||
|
|
Loading…
Reference in New Issue