issue504: verbose output displays node IDs for each test
Replace the verbose per-test reporting format of `file:line test_name RESULT` with the node ID of the test, i.e. `file@line::class::method[param] RESULT`. This patch does not update the examples in the docs; @hpk42 has a script to regenerate those. --HG-- branch : issue504
This commit is contained in:
+9
-2
@@ -2,6 +2,7 @@
|
||||
|
||||
import py
|
||||
# DON't import pytest here because it causes import cycle troubles
|
||||
import re
|
||||
import sys, os
|
||||
from _pytest import hookspec # the extension point definitions
|
||||
from _pytest.core import PluginManager
|
||||
@@ -180,7 +181,7 @@ class Parser:
|
||||
a = option.attrs()
|
||||
arggroup.add_argument(*n, **a)
|
||||
# bash like autocompletion for dirs (appending '/')
|
||||
optparser.add_argument(FILE_OR_DIR, nargs='*'
|
||||
optparser.add_argument(FILE_OR_DIR, nargs='*', type=node_with_line_number,
|
||||
).completer=filescompleter
|
||||
return optparser
|
||||
|
||||
@@ -699,7 +700,7 @@ class Config(object):
|
||||
except ConftestImportFailure:
|
||||
e = sys.exc_info()[1]
|
||||
if ns.help or ns.version:
|
||||
# we don't want to prevent --help/--version to work
|
||||
# we don't want to prevent --help/--version to work
|
||||
# so just let is pass and print a warning at the end
|
||||
self.pluginmanager._warnings.append(
|
||||
"could not load initial conftests (%s)\n" % e.path)
|
||||
@@ -839,6 +840,12 @@ def getcfg(args, inibasenames):
|
||||
return {}
|
||||
|
||||
|
||||
def node_with_line_number(string):
|
||||
split = string.split('[')
|
||||
split[0] = re.sub(r'@\d+', '', split[0])
|
||||
return '['.join(split)
|
||||
|
||||
|
||||
def setns(obj, dic):
|
||||
import pytest
|
||||
for name, value in dic.items():
|
||||
|
||||
Reference in New Issue
Block a user