Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest 7.1.2 fails over tomli import on Python 3.11.0b1 #9982

Closed
gitpushdashf opened this issue May 20, 2022 · 14 comments
Closed

pytest 7.1.2 fails over tomli import on Python 3.11.0b1 #9982

gitpushdashf opened this issue May 20, 2022 · 14 comments
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity

Comments

@gitpushdashf
Copy link

gitpushdashf commented May 20, 2022

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.

@RonnyPfannschmidt
Copy link
Member

https://github.com/pytest-dev/pytest/pull/9741/files was supposed to fix that i believe

@RonnyPfannschmidt
Copy link
Member

@nicoddemus @bluetech seems like we missed to backport this one, i added the labels, but i probably wont get to it this weekend myself

@RonnyPfannschmidt
Copy link
Member

closing - #9983 should resolve this once we merge/release

@RonnyPfannschmidt
Copy link
Member

@gitpushdashf thanks for bringing this to attention

@bluetech
Copy link
Member

A backport doesn't hurt, although I don't see why it would be needed - tomli should still work on Python 3.11. It looks like @gitpushdashf doesn't have that package installed.

@gitpushdashf
Copy link
Author

@gitpushdashf thanks for bringing this to attention

Great, thank you so much!

A backport doesn't hurt, although I don't see why it would be needed - tomli should still work on Python 3.11. It looks like @gitpushdashf doesn't have that package installed.

I installed this in Docker, so it's a clean, standalone environment. I think it has to be some kind of dependency issue. Python 3.11 includes tomllib, preferably used instead of tomli.

@The-Compiler
Copy link
Member

I agree this sounds like an issue in your setup, @gitpushdashf, and not pytest.

pytest depends on tomli (unconditionally, with 7.1.2), and evidently that's not installed in your setup.

How are you installing pytest? Can you share the Dockerfile perhaps?

@The-Compiler The-Compiler reopened this May 24, 2022
@The-Compiler The-Compiler added the status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity label May 24, 2022
@gitpushdashf
Copy link
Author

I agree this sounds like an issue in your setup, @gitpushdashf, and not pytest.

pytest depends on tomli (unconditionally, with 7.1.2), and evidently that's not installed in your setup.

How are you installing pytest? Can you share the Dockerfile perhaps?

I'm starting to think you might be right. It's actually just one project I'm running into this with. Let me do some digging.

@gitpushdashf
Copy link
Author

You're right! This is an issue with my virtualenv manager. My bad. Should I close this out?

@nicoddemus
Copy link
Member

Yeah, thanks @gitpushdashf!

@cclauss
Copy link
Contributor

cclauss commented Sep 8, 2022

This issue is closed but was the problem really fixed?
https://docs.pytest.org/en/stable/changelog.html does not mention 3.11

@nicoddemus
Copy link
Member

@cclauss This will be released in pytest 7.2.0 only.

@cclauss
Copy link
Contributor

cclauss commented Sep 8, 2022

Maybe reopen the issue until v7.2.0 lands?

@nicoddemus
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity
Projects
None yet
Development

No branches or pull requests

6 participants