question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pytest 7.1.2 fails over tomli import on Python 3.11.0b1

See original GitHub issue
python -m pytest --cov=scripts --cov-report=term --cov-fail-under=90 --durations=3
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/local/lib/python3.11/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/__init__.py", line 187, in console_main
    code = main()
           ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/__init__.py", line 145, in main
    config = _prepareconfig(args, plugins)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/__init__.py", line 324, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
    ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/helpconfig.py", line 102, in pytest_cmdline_parse
    config: Config = outcome.get_result()
                     ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1016, in pytest_cmdline_parse
    self.parse(args)
    ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1304, in parse
    self._preparse(args, addopts=addopts)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1172, in _preparse
    self._initini(args)
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1091, in _initini
    rootpath, inipath, inicfg = determine_setup(
                                ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/findpaths.py", line 186, in determine_setup
    rootdir, inipath, inicfg = locate_config([ancestor])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/findpaths.py", line 108, in locate_config
    ini_config = load_config_dict_from_file(p)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/_pytest/config/findpaths.py", line 67, in load_config_dict_from_file
    import tomli
    ^^^^^^^^^^^^
ModuleNotFoundError: No module named 'tomli'
Unable to run command:
    ``python -m pytest --cov=scripts --cov-report=term --cov-fail-under=90 --durations=3``. 
  Message:
Command 'python -m pytest --cov=scripts --cov-report=term --cov-fail-under=90 --durations=3' returned non-zero exit status 1.

I can try to come up with a minimal test case for this if needed.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
RonnyPfannschmidtcommented, May 20, 2022

@gitpushdashf thanks for bringing this to attention

0reactions
nicoddemuscommented, Sep 8, 2022

Our workflow is to close an issue as soon as it has been fixed, not if it has been released already.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pytest import problems when tests import from adjacent directory
x.xy import XY I get “cannot import” because it's from a directory one level above. I also tried running Python -m pytest tests ......
Read more >
Changelog — pytest documentation
tomli is no longer a dependency on Python 3.11. ... Fixes a crash during a failed teardown in unittest TestCases with non-default __init__...
Read more >
Release 7.0.0b1 unknown - Coverage.py
Coverage.py is a tool for measuring code coverage of Python programs. ... the execution during import hadn't been measured.
Read more >
Python 3.11 Preview: TOML and tomllib - Real Python
Python 3.11 will be released in October 2022. In this tutorial, you'll install the latest beta release of Python 3.11 in order to...
Read more >
Release notes — Anaconda documentation
pyqt 5.9.2 -> 5.15.7; pytest 7.1.1 -> 7.1.2; python 3.9.12 -> 3.9.13; python-fastjsonschema ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found