feat(pytest): use python_functions config option (#100)
This commit is contained in:
@@ -58,6 +58,13 @@ def main(argv: List[str]):
|
||||
collect(argv)
|
||||
return
|
||||
|
||||
if "--pytest-extract-test-name-template" in argv:
|
||||
argv.remove("--pytest-extract-test-name-template")
|
||||
from .pytest import extract_test_name_template
|
||||
|
||||
extract_test_name_template(argv)
|
||||
return
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
adapter = get_adapter(TestRunner(args.runner), args.emit_parameterized_ids)
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from io import StringIO
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Callable, Dict, List, Optional, Union
|
||||
|
||||
@@ -205,5 +206,16 @@ class NeotestDebugpyPlugin:
|
||||
additional_info.is_tracing -= 1
|
||||
|
||||
|
||||
class TestNameTemplateExtractor:
|
||||
@staticmethod
|
||||
def pytest_collection_modifyitems(config):
|
||||
config = {"python_functions": config.getini("python_functions")[0]}
|
||||
print(f"\n{json.dumps(config)}\n")
|
||||
|
||||
|
||||
def extract_test_name_template(args):
|
||||
pytest.main(args=["-k", "neotest_none"], plugins=[TestNameTemplateExtractor])
|
||||
|
||||
|
||||
def collect(args):
|
||||
pytest.main(["--collect-only", "--verbosity=0", "-q"] + args)
|
||||
|
Reference in New Issue
Block a user