D:.
└─fake_data
│ conftest.py
│ pytest.ini
│ __init__.py
│
└─test_one
test_haha.py
__init__.py
(base) PS D:\gitrepository\test_owl> & D:/python/anaconda3/python.exe -u d:/gitrepository/test_owl/fake_data/test_one/test_haha.py
========================================================= test session starts =========================================================
platform win32 -- Python 3.10.9, pytest-7.1.2, pluggy-1.0.0 -- D:\python\anaconda3\python.exe
cachedir: .pytest_cache
rootdir: d:\gitrepository\test_owl\fake_data, configfile: pytest.ini
plugins: anyio-3.5.0
collected 0 items
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\main.py", line 268, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\main.py", line 321, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\pluggy\_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\pluggy\_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\main.py", line 332, in pytest_collection
INTERNALERROR> session.perform_collect()
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\main.py", line 643, in perform_collect
INTERNALERROR> rep = collect_one_node(self)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\runner.py", line 535, in collect_one_node
INTERNALERROR> ihook = collector.ihook
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\nodes.py", line 269, in ihook
INTERNALERROR> return self.session.gethookproxy(self.path)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\main.py", line 539, in gethookproxy
INTERNALERROR> my_conftestmodules = pm._getconftestmodules(
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\config\__init__.py", line 575, in _getconftestmodules
INTERNALERROR> mod = self._importconftest(conftestpath, importmode, rootpath)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\config\__init__.py", line 623, in _importconftest
INTERNALERROR> self.consider_conftest(mod)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\config\__init__.py", line 704, in consider_conftest
INTERNALERROR> self.register(conftestmodule, name=conftestmodule.__file__)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\_pytest\config\__init__.py", line 463, in register
INTERNALERROR> ret: Optional[str] = super().register(plugin, name)
INTERNALERROR> File "D:\python\anaconda3\lib\site-packages\pluggy\_manager.py", line 91, in register
INTERNALERROR> raise ValueError(
INTERNALERROR> ValueError: Plugin already registered: D:\gitrepository\test_owl\fake_data\conftest.py=<module 'fake_data.conftest' from
'D:\\gitrepository\\test_owl\\fake_data\\conftest.py'>
INTERNALERROR> {'2225410613904': <_pytest.config.PytestPluginManager object at 0x0000020624CF2290>, 'pytestconfig': <_pytest.config.Config object at 0x0000020625A3CF40>, 'mark': <module '_pytest.mark' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\mark\\__init__.py'>, 'main': <module '_pytest.main' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\main.py'>, 'runner': <module '_pytest.runner' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\runner.py'>, 'fixtures': <module '_pytest.fixtures' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\fixtures.py'>, 'helpconfig': <module '_pytest.helpconfig' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\helpconfig.py'>, 'python': <module '_pytest.python' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\python.py'>, 'terminal': <module '_pytest.terminal' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\terminal.py'>, 'debugging': <module '_pytest.debugging' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\debugging.py'>, 'unittest': <module '_pytest.unittest'
from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\unittest.py'>, 'capture': <module '_pytest.capture' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\capture.py'>, 'skipping': <module '_pytest.skipping' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\skipping.py'>, 'legacypath': <module '_pytest.legacypath' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\legacypath.py'>, 'tmpdir': <module '_pytest.tmpdir' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\tmpdir.py'>, 'monkeypatch': <module '_pytest.monkeypatch' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\monkeypatch.py'>, 'recwarn': <module '_pytest.recwarn' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\recwarn.py'>, 'pastebin': <module '_pytest.pastebin' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\pastebin.py'>, 'nose': <module '_pytest.nose' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\nose.py'>, 'assertion': <module '_pytest.assertion' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\assertion\\__init__.py'>, 'junitxml': <module '_pytest.junitxml' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\junitxml.py'>, 'doctest': <module '_pytest.doctest' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\doctest.py'>, 'cacheprovider': <module '_pytest.cacheprovider' from
'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\cacheprovider.py'>, 'freeze_support': <module '_pytest.freeze_support' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\freeze_support.py'>, 'setuponly': <module '_pytest.setuponly' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\setuponly.py'>, 'setupplan': <module '_pytest.setupplan' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\setupplan.py'>, 'stepwise': <module '_pytest.stepwise' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\stepwise.py'>, 'warnings': <module '_pytest.warnings' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\warnings.py'>, 'logging': <module '_pytest.logging' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\logging.py'>, 'reports': <module '_pytest.reports' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\reports.py'>, 'python_path': <module '_pytest.python_path' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\python_path.py'>, 'unraisableexception': <module '_pytest.unraisableexception' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\unraisableexception.py'>, 'threadexception': <module '_pytest.threadexception' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\threadexception.py'>, 'faulthandler': <module '_pytest.faulthandler' from 'D:\\python\\anaconda3\\lib\\site-packages\\_pytest\\faulthandler.py'>, 'anyio': <module 'anyio.pytest_plugin' from 'D:\\python\\anaconda3\\lib\\site-packages\\anyio\\pytest_plugin.py'>, 'capturemanager': <CaptureManager _method='no' _global_capturing=<MultiCapture out=None err=None in_=None _state='suspended' _in_suspended=False> _capture_fixture=None>, 'D:\\gitrepository\\test_owl\\fake_data\\conftest.py': <module 'fake_data.conftest' from 'D:\\gitrepository\\test_owl\\fake_data\\conftest.py'>, 'session': <Session fake_data exitstatus=<ExitCode.OK: 0> testsfailed=0 testscollected=0>, 'lfplugin': <_pytest.cacheprovider.LFPlugin object at 0x0000020625AFCCD0>, 'nfplugin': <_pytest.cacheprovider.NFPlugin object at 0x0000020625AFCB80>, 'legacypath-tmpdir': <class '_pytest.legacypath.LegacyTmpdirPlugin'>, 'terminalreporter': <_pytest.terminal.TerminalReporter object at 0x00000206265F1870>, 'logging-plugin': <_pytest.logging.LoggingPlugin object at 0x00000206265F3A90>, 'funcmanage': <_pytest.fixtures.FixtureManager object at 0x0000020625A3D0F0>}
======================================================== no tests ran in 0.05s ========================================================
I think this line of code in
test.haha.pyis the cause of the error. But I don't know why:Situation 1: use
pytest -sv -m test; everything thing is ok!Situation 2: use vscode plugin [code runner]
python.exe d:/fake_date/test_haha.py; everything thing is ok!Situation 3: run in terminal,
python.exe d:/fake_date/test_haha.py; then an error has occurred:test_owl.zip