fix issue544 by only removing "@NUM" at the end of a part (parts are
separated by "::") and if the part has an .py extension. --HG-- branch : fix_initial_parsing
This commit is contained in:
parent
5ccd3f2fc5
commit
40eed363e8
|
@ -12,6 +12,8 @@ NEXT
|
||||||
- fix issue with detecting conftest files if the arguments contain
|
- fix issue with detecting conftest files if the arguments contain
|
||||||
"::" node id specifications (copy pasted from "-v" output)
|
"::" node id specifications (copy pasted from "-v" output)
|
||||||
|
|
||||||
|
- fix issue544 by only removing "@NUM" at the end of "::" separated parts
|
||||||
|
and if the part has an ".py" extension
|
||||||
|
|
||||||
2.6
|
2.6
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
|
@ -863,9 +863,13 @@ def getcfg(args, inibasenames):
|
||||||
|
|
||||||
|
|
||||||
def node_with_line_number(string):
|
def node_with_line_number(string):
|
||||||
split = string.split('[')
|
newparts = []
|
||||||
split[0] = re.sub(r'@\d+', '', split[0])
|
for part in string.split("::"):
|
||||||
return '['.join(split)
|
m = re.match(r'.*\.py@\d+$', part)
|
||||||
|
if m is not None:
|
||||||
|
part = part[:part.rfind("@")]
|
||||||
|
newparts.append(part)
|
||||||
|
return "::".join(newparts)
|
||||||
|
|
||||||
|
|
||||||
def setns(obj, dic):
|
def setns(obj, dic):
|
||||||
|
|
|
@ -146,8 +146,17 @@ class TestParser:
|
||||||
assert args.S == False
|
assert args.S == False
|
||||||
|
|
||||||
def test_parse_removes_line_number_from_positional_arguments(self, parser):
|
def test_parse_removes_line_number_from_positional_arguments(self, parser):
|
||||||
args = parser.parse(['path@2::func', 'path2@5::func2[param with @]'])
|
args = parser.parse(['path.txt@2::item',
|
||||||
assert getattr(args, parseopt.FILE_OR_DIR) == ['path::func', 'path2::func2[param with @]']
|
'path2.py::func2[param with .py@123]',
|
||||||
|
'path.py@123',
|
||||||
|
'hello/path.py@123',
|
||||||
|
])
|
||||||
|
assert getattr(args, parseopt.FILE_OR_DIR) == [
|
||||||
|
'path.txt@2::item',
|
||||||
|
'path2.py::func2[param with .py@123]',
|
||||||
|
'path.py',
|
||||||
|
'hello/path.py',
|
||||||
|
]
|
||||||
|
|
||||||
def test_parse_defaultgetter(self):
|
def test_parse_defaultgetter(self):
|
||||||
def defaultget(option):
|
def defaultget(option):
|
||||||
|
|
Loading…
Reference in New Issue