diff --git a/_pytest/config.py b/_pytest/config.py index 1eeb6b3b7..65173c661 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -2,7 +2,6 @@ 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 @@ -181,8 +180,7 @@ class Parser: a = option.attrs() arggroup.add_argument(*n, **a) # bash like autocompletion for dirs (appending '/') - optparser.add_argument(FILE_OR_DIR, nargs='*', type=node_with_line_number, - ).completer=filescompleter + optparser.add_argument(FILE_OR_DIR, nargs='*').completer=filescompleter return optparser def parse_setoption(self, args, option): @@ -862,13 +860,6 @@ def getcfg(args, inibasenames): return {} -rex_pyat = re.compile(r'(.*\.py)@\d+$') - -def node_with_line_number(string): - return "::".join(rex_pyat.sub(lambda m: m.group(1), part) - for part in string.split("::")) - - def setns(obj, dic): import pytest for name, value in dic.items(): diff --git a/_pytest/terminal.py b/_pytest/terminal.py index abb8f1549..18f3f9f6a 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -380,9 +380,6 @@ class TerminalReporter: fspath = "%s <- %s" % (collect_fspath, fspath) if fspath: line = str(fspath) - if lineno is not None: - lineno += 1 - line += "@" + str(lineno) if domain: split = str(domain).split('[') split[0] = split[0].replace('.', '::') # don't replace '.' in params diff --git a/testing/python/fixture.py b/testing/python/fixture.py index d2b18c39b..fd8131827 100644 --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -1692,22 +1692,22 @@ class TestFixtureMarker: """) result = testdir.runpytest("-v") result.stdout.fnmatch_lines(""" - test_mod1.py@1::test_func[s1] PASSED - test_mod2.py@1::test_func2[s1] PASSED - test_mod2.py@3::test_func3[s1-m1] PASSED - test_mod2.py@5::test_func3b[s1-m1] PASSED - test_mod2.py@3::test_func3[s1-m2] PASSED - test_mod2.py@5::test_func3b[s1-m2] PASSED - test_mod1.py@1::test_func[s2] PASSED - test_mod2.py@1::test_func2[s2] PASSED - test_mod2.py@3::test_func3[s2-m1] PASSED - test_mod2.py@5::test_func3b[s2-m1] PASSED - test_mod2.py@7::test_func4[m1] PASSED - test_mod2.py@3::test_func3[s2-m2] PASSED - test_mod2.py@5::test_func3b[s2-m2] PASSED - test_mod2.py@7::test_func4[m2] PASSED - test_mod1.py@3::test_func1[m1] PASSED - test_mod1.py@3::test_func1[m2] PASSED + test_mod1.py::test_func[s1] PASSED + test_mod2.py::test_func2[s1] PASSED + test_mod2.py::test_func3[s1-m1] PASSED + test_mod2.py::test_func3b[s1-m1] PASSED + test_mod2.py::test_func3[s1-m2] PASSED + test_mod2.py::test_func3b[s1-m2] PASSED + test_mod1.py::test_func[s2] PASSED + test_mod2.py::test_func2[s2] PASSED + test_mod2.py::test_func3[s2-m1] PASSED + test_mod2.py::test_func3b[s2-m1] PASSED + test_mod2.py::test_func4[m1] PASSED + test_mod2.py::test_func3[s2-m2] PASSED + test_mod2.py::test_func3b[s2-m2] PASSED + test_mod2.py::test_func4[m2] PASSED + test_mod1.py::test_func1[m1] PASSED + test_mod1.py::test_func1[m2] PASSED """) def test_class_ordering(self, testdir): @@ -1744,18 +1744,18 @@ class TestFixtureMarker: """) result = testdir.runpytest("-vs") result.stdout.fnmatch_lines(""" - test_class_ordering.py@4::TestClass2::test_1[1-a] PASSED - test_class_ordering.py@4::TestClass2::test_1[2-a] PASSED - test_class_ordering.py@6::TestClass2::test_2[1-a] PASSED - test_class_ordering.py@6::TestClass2::test_2[2-a] PASSED - test_class_ordering.py@4::TestClass2::test_1[1-b] PASSED - test_class_ordering.py@4::TestClass2::test_1[2-b] PASSED - test_class_ordering.py@6::TestClass2::test_2[1-b] PASSED - test_class_ordering.py@6::TestClass2::test_2[2-b] PASSED - test_class_ordering.py@9::TestClass::test_3[1-a] PASSED - test_class_ordering.py@9::TestClass::test_3[2-a] PASSED - test_class_ordering.py@9::TestClass::test_3[1-b] PASSED - test_class_ordering.py@9::TestClass::test_3[2-b] PASSED + test_class_ordering.py::TestClass2::test_1[1-a] PASSED + test_class_ordering.py::TestClass2::test_1[2-a] PASSED + test_class_ordering.py::TestClass2::test_2[1-a] PASSED + test_class_ordering.py::TestClass2::test_2[2-a] PASSED + test_class_ordering.py::TestClass2::test_1[1-b] PASSED + test_class_ordering.py::TestClass2::test_1[2-b] PASSED + test_class_ordering.py::TestClass2::test_2[1-b] PASSED + test_class_ordering.py::TestClass2::test_2[2-b] PASSED + test_class_ordering.py::TestClass::test_3[1-a] PASSED + test_class_ordering.py::TestClass::test_3[2-a] PASSED + test_class_ordering.py::TestClass::test_3[1-b] PASSED + test_class_ordering.py::TestClass::test_3[2-b] PASSED """) def test_parametrize_separated_order_higher_scope_first(self, testdir): diff --git a/testing/test_conftest.py b/testing/test_conftest.py index 8bf936dbe..3f39cfc5d 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -251,7 +251,7 @@ def test_conftest_found_with_double_dash(testdir): def test_hello(found): assert found == 1 """)) - result = testdir.runpytest(str(p) + "@2::test_hello", "-h") + result = testdir.runpytest(str(p) + "::test_hello", "-h") result.stdout.fnmatch_lines(""" *--hello-world* """) diff --git a/testing/test_parseopt.py b/testing/test_parseopt.py index 36defef2c..4b3a71475 100644 --- a/testing/test_parseopt.py +++ b/testing/test_parseopt.py @@ -145,21 +145,6 @@ class TestParser: assert args.R == True assert args.S == False - def test_parse_removes_line_number_from_positional_arguments(self, parser): - args = parser.parse(['path.txt@2::item', - 'path2.py::func2[param with .py@123]', - 'path.py@123', - 'hello/path.py@123', - ]) - # we only remove "@NUM" syntax for .py files which are currently - # the only ones which can produce it. - 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 defaultget(option): if not hasattr(option, 'type'): diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 202e08e0a..b543e1c6d 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -51,9 +51,9 @@ class TestTerminal: result = testdir.runpytest(*option.args) if option.verbose: result.stdout.fnmatch_lines([ - "*test_pass_skip_fail.py@2::test_ok PASS*", - "*test_pass_skip_fail.py@4::test_skip SKIP*", - "*test_pass_skip_fail.py@6::test_func FAIL*", + "*test_pass_skip_fail.py::test_ok PASS*", + "*test_pass_skip_fail.py::test_skip SKIP*", + "*test_pass_skip_fail.py::test_func FAIL*", ]) else: result.stdout.fnmatch_lines([ @@ -126,7 +126,7 @@ class TestTerminal: ]) result = testdir.runpytest("-v", p2) result.stdout.fnmatch_lines([ - "*test_p2.py <- *test_p1.py@2::TestMore::test_p1*", + "*test_p2.py <- *test_p1.py::TestMore::test_p1*", ]) def test_itemreport_directclasses_not_shown_as_subclasses(self, testdir): @@ -450,17 +450,17 @@ class TestTerminalFunctional: """) result = testdir.runpytest(p1, '-v') result.stdout.fnmatch_lines([ - "*test_verbose_reporting.py@2::test_fail *FAIL*", - "*test_verbose_reporting.py@4::test_pass *PASS*", - "*test_verbose_reporting.py@7::TestClass::test_skip *SKIP*", - "*test_verbose_reporting.py@10::test_gen*0* *FAIL*", + "*test_verbose_reporting.py::test_fail *FAIL*", + "*test_verbose_reporting.py::test_pass *PASS*", + "*test_verbose_reporting.py::TestClass::test_skip *SKIP*", + "*test_verbose_reporting.py::test_gen*0* *FAIL*", ]) assert result.ret == 1 pytestconfig.pluginmanager.skipifmissing("xdist") result = testdir.runpytest(p1, '-v', '-n 1') result.stdout.fnmatch_lines([ - "*FAIL*test_verbose_reporting.py@2::test_fail*", + "*FAIL*test_verbose_reporting.py::test_fail*", ]) assert result.ret == 1