dunossauro / fastapi-do-zero

Curso básico de FastAPI
https://fastapidozero.dunossauro.com/
679 stars 73 forks source link

Erro no pytest #228

Closed fabiocasadossites closed 2 months ago

fabiocasadossites commented 3 months ago

Quando eu tento fazer os teste Screenshot_3

deadpoolandwolverine-backend-py3.12fabio@Fabio:~/projetos/projetos_mensal/deadpoolandwolverine-backend$ task test
All checks passed!
Traceback (most recent call last):
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/bin/pytest", line 8, in <module>
    sys.exit(console_main())
             ^^^^^^^^^^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 201, in console_main
    code = main()
           ^^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 156, in main
    config = _prepareconfig(args, plugins)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 341, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/_pytest/helpconfig.py", line 105, in pytest_cmdline_parse
    config = yield
             ^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1140, in pytest_cmdline_parse
    self.parse(args)
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1490, in parse
    self._preparse(args, addopts=addopts)
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1377, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/home/fabio/.pyenv/versions/3.12.4/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabio/.pyenv/versions/3.12.4/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 174, in exec_module
    exec(co, module.__dict__)
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/pytest_cov/plugin.py", line 9, in <module>
    import coverage
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/coverage/__init__.py", line 24, in <module>
    from coverage.control import (
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/coverage/control.py", line 29, in <module>
    from coverage.collector import Collector
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/coverage/collector.py", line 21, in <module>
    from coverage.data import CoverageData
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/coverage/data.py", line 25, in <module>
    from coverage.sqldata import CoverageData
  File "/home/fabio/.cache/pypoetry/virtualenvs/deadpoolandwolverine-backend-oEMflryn-py3.12/lib/python3.12/site-packages/coverage/sqldata.py", line 16, in <module>
    import sqlite3
  File "/home/fabio/.pyenv/versions/3.12.4/lib/python3.12/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/home/fabio/.pyenv/versions/3.12.4/lib/python3.12/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
fabiocasadossites commented 3 months ago

Eu consegui, caso alguém tenha o mesmo problema eu deletei o env do poetry

poetry env remove --all

criei outro com

poetry shell

é instalei novamente com:

poetry install

dunossauro commented 2 months ago

é noiz :heart_eyes: