diff --git a/Python/Product/TestAdapter.Executor/PythonFiles/testing_tools/adapter/pytest/_discovery.py b/Python/Product/TestAdapter.Executor/PythonFiles/testing_tools/adapter/pytest/_discovery.py index 7957e1be9..c0101cafd 100644 --- a/Python/Product/TestAdapter.Executor/PythonFiles/testing_tools/adapter/pytest/_discovery.py +++ b/Python/Product/TestAdapter.Executor/PythonFiles/testing_tools/adapter/pytest/_discovery.py @@ -9,27 +9,6 @@ import pytest from .. import util, discovery from ._pytest_item import parse_item -#note: this must match testlauncher.py -def patch_translate_non_printable(): - import _pytest.compat - translate_non_printable = getattr(_pytest.compat, "_translate_non_printable", None) - - if translate_non_printable: - def _translate_non_printable_patched(s): - s = translate_non_printable(s) - s = s.replace(':', '/:') # pytest testcase not found error and VS TestExplorer FQN parsing - s = s.replace('.', '_') # VS TestExplorer FQN parsing - s = s.replace('\n', '/n') # pytest testcase not found error - s = s.replace('\\', '/') # pytest testcase not found error, fixes cases (actual backslash followed by n) - s = s.replace('\r', '/r') # pytest testcase not found error - return s - - _pytest.compat._translate_non_printable = _translate_non_printable_patched - else: - print("ERROR: failed to patch pytest, _pytest.compat._translate_non_printable") - -patch_translate_non_printable() - def discover(pytestargs=None, hidestdio=False, _pytest_main=pytest.main, _plugin=None, **_ignored): """Return the results of test discovery.""" diff --git a/Python/Product/TestAdapter/testlauncher.py b/Python/Product/TestAdapter/testlauncher.py index 28dd3ddbb..46537cf78 100644 --- a/Python/Product/TestAdapter/testlauncher.py +++ b/Python/Product/TestAdapter/testlauncher.py @@ -116,7 +116,6 @@ def run(testRunner, coverage_file, test_file, args): if testRunner == 'pytest': import pytest - patch_translate_non_printable() _plugin = TestCollector() pytest.main(args, [_plugin]) else: @@ -130,26 +129,6 @@ def run(testRunner, coverage_file, test_file, args): cov.save() cov.xml_report(outfile = coverage_file + '.xml', omit=__file__) -#note: this must match adapter\pytest\_discovery.py -def patch_translate_non_printable(): - import _pytest.compat - translate_non_printable = getattr(_pytest.compat, "_translate_non_printable") - - if translate_non_printable: - def _translate_non_printable_patched(s): - s = translate_non_printable(s) - s = s.replace(':', '/:') # pytest testcase not found error and VS TestExplorer FQN parsing - s = s.replace('.', '_') # VS TestExplorer FQN parsing - s = s.replace('\n', '/n') # pytest testcase not found error - s = s.replace('\\', '/') # pytest testcase not found error, fixes cases (actual backslash followed by n) - s = s.replace('\r', '/r') # pytest testcase not found error - return s - - _pytest.compat._translate_non_printable = _translate_non_printable_patched - else: - print("ERROR: failed to patch pytest, _pytest.compat._translate_non_printable") - - class TestCollector(object): """This is a pytest plugin that prevents notfound errors from ending execution of tests.""" diff --git a/package.json b/package.json index 73be4830f..cfec7e194 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,6 @@ "name": "ptvs", "private": true, "devDependencies": { - "@pylance/pylance": "2024.5.1" + "@pylance/pylance": "2024.7.1" } }