File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -143,3 +143,26 @@ def pytest_configure(config):
143143 ''' )
144144 result = testdir .runpytest_subprocess ('--mypy' , * xdist_args )
145145 assert result .ret == 0
146+
147+
148+ def test_pytest_collection_modifyitems (testdir , xdist_args ):
149+ testdir .makepyfile (conftest = '''
150+ def pytest_collection_modifyitems(session, config, items):
151+ plugin = config.pluginmanager.getplugin('mypy')
152+ for mypy_item_i in reversed([
153+ i
154+ for i, item in enumerate(items)
155+ if isinstance(item, plugin.MypyItem)
156+ ]):
157+ items.pop(mypy_item_i)
158+ ''' )
159+ testdir .makepyfile ('''
160+ def myfunc(x: int) -> str:
161+ return x * 2
162+
163+ def test_pass():
164+ pass
165+ ''' )
166+ result = testdir .runpytest_subprocess ('--mypy' , * xdist_args )
167+ result .assert_outcomes (passed = 1 )
168+ assert result .ret == 0
You can’t perform that action at this time.
0 commit comments