File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1010
1111
1212mypy_argv = []
13+ nodeid_name = 'mypy'
1314
1415
1516def pytest_addoption (parser ):
@@ -77,7 +78,14 @@ def pytest_collect_file(path, parent):
7778 parent .config .option .mypy ,
7879 parent .config .option .mypy_ignore_missing_imports ,
7980 ]):
80- return MypyItem (path , parent )
81+ item = MypyItem (path , parent )
82+ if nodeid_name :
83+ item = MypyItem (
84+ path ,
85+ parent ,
86+ nodeid = '::' .join ([item .nodeid , nodeid_name ]),
87+ )
88+ return item
8189 return None
8290
8391
Original file line number Diff line number Diff line change @@ -145,6 +145,19 @@ def pytest_configure(config):
145145 assert result .ret == 0
146146
147147
148+ def test_api_nodeid_name (testdir , xdist_args ):
149+ """Ensure that the plugin can be configured in a conftest.py."""
150+ nodeid_name = 'UnmistakableNodeIDName'
151+ testdir .makepyfile (conftest = '''
152+ def pytest_configure(config):
153+ plugin = config.pluginmanager.getplugin('mypy')
154+ plugin.nodeid_name = '{}'
155+ ''' .format (nodeid_name ))
156+ result = testdir .runpytest_subprocess ('--mypy' , '--verbose' , * xdist_args )
157+ result .stdout .fnmatch_lines (['*conftest.py::' + nodeid_name + '*' ])
158+ assert result .ret == 0
159+
160+
148161def test_pytest_collection_modifyitems (testdir , xdist_args ):
149162 testdir .makepyfile (conftest = '''
150163 def pytest_collection_modifyitems(session, config, items):
You can’t perform that action at this time.
0 commit comments