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

Tests failing when building locally (in typeguard) #680

Closed
jaraco opened this issue Apr 16, 2024 · 14 comments · Fixed by #703
Closed

Tests failing when building locally (in typeguard) #680

jaraco opened this issue Apr 16, 2024 · 14 comments · Fixed by #703
Labels
bug Something is broken triage

Comments

@jaraco
Copy link
Member

jaraco commented Apr 16, 2024

When testing locally, I'm seeing this error:

 cheroot main @ tox
py: install_deps> .tox/py/bin/python -bb -E -s /Users/jaraco/code/cherrypy/cheroot/bin/pip-wrapper py /Users/jaraco/code/cherrypy/cheroot/requirements/ install -r requirements/tests.in
.pkg: install_requires> python -I -m pip install 'setuptools-scm>=7.0.0' 'setuptools>=34.4'
.pkg: _optional_hooks> python '/Users/jaraco/Library/Application Support/pipx/venvs/tox/lib/python3.12/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
.pkg: get_requires_for_build_editable> python '/Users/jaraco/Library/Application Support/pipx/venvs/tox/lib/python3.12/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
.pkg: install_requires_for_build_editable> python -I -m pip install 'setuptools_scm>=7.0.0' wheel
.pkg: build_editable> python '/Users/jaraco/Library/Application Support/pipx/venvs/tox/lib/python3.12/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
py: install_package_deps> .tox/py/bin/python -bb -E -s /Users/jaraco/code/cherrypy/cheroot/bin/pip-wrapper py /Users/jaraco/code/cherrypy/cheroot/requirements/ install 'importlib-metadata; python_version < "3.8"' jaraco.functools 'more-itertools>=2.6'
py: install_package> .tox/py/bin/python -bb -E -s /Users/jaraco/code/cherrypy/cheroot/bin/pip-wrapper py /Users/jaraco/code/cherrypy/cheroot/requirements/ install --force-reinstall --no-deps /Users/jaraco/code/cherrypy/cheroot/.tox/.tmp/package/1/cheroot-11.0.0b1.dev27+g9d4de6b0-0.editable-py3-none-any.whl
py: commands_pre[0]> .tox/py/bin/python -bb -E -s -m OpenSSL.debug
pyOpenSSL: 24.1.0
cryptography: 42.0.5
cffi: 1.16.0
cryptography's compiled against OpenSSL: OpenSSL 3.2.1 30 Jan 2024
cryptography's linked OpenSSL: OpenSSL 3.2.1 30 Jan 2024
Python's OpenSSL: OpenSSL 3.2.1 30 Jan 2024
Python executable: /Users/jaraco/code/cherrypy/cheroot/.tox/py/bin/python
Python version: 3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Platform: darwin
sys.path: ['/Users/jaraco/code/cherrypy/cheroot', '/opt/homebrew/Cellar/[email protected]/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python312.zip', '/opt/homebrew/Cellar/[email protected]/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12', '/opt/homebrew/Cellar/[email protected]/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload', '/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages']
py: commands[0]> .tox/py/bin/python -bb -E -s -m pytest --color=yes
/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/config/__init__.py:318: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ImportError: cannot import name 'Config' from 'pytest' (/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pytest/__init__.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
           ^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/config/__init__.py", line 143, in main
    config = _prepareconfig(args, plugins)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pluggy/_hooks.py", line 501, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pluggy/_manager.py", line 119, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pluggy/_callers.py", line 155, in _multicall
    teardown[0].send(outcome)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
    config: Config = outcome.get_result()
                     ^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pluggy/_result.py", line 99, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pluggy/_callers.py", line 102, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1283, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1172, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pluggy/_manager.py", line 414, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.2_1/Frameworks/Python.framework/Versions/3.12/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 "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 170, in exec_module
    exec(co, module.__dict__)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/typeguard/_pytest_plugin.py", line 7, in <module>
    from pytest import Config, Parser
ImportError: cannot import name 'Config' from 'pytest' (/Users/jaraco/code/cherrypy/cheroot/.tox/py/lib/python3.12/site-packages/pytest/__init__.py)
py: exit 1 (0.21 seconds) /Users/jaraco/code/cherrypy/cheroot> .tox/py/bin/python -bb -E -s -m pytest --color=yes pid=34147
  py: FAIL code 1 (8.42=setup[7.88]+cmd[0.33,0.21] seconds)
  evaluation failed :( (8.47 seconds)

I'm not sure why I'm not seeing the error in CI.

@jaraco jaraco added bug Something is broken triage labels Apr 16, 2024
@jaraco
Copy link
Member Author

jaraco commented Apr 16, 2024

Same error was reported in agronholm/typeguard#343.

@jaraco
Copy link
Member Author

jaraco commented Apr 16, 2024

I do see that pytest==6.2.5 is getting installed.

@jaraco
Copy link
Member Author

jaraco commented Apr 16, 2024

typeguard isn't being installed in CI, so that's probably why the issue isn't being encountered. I suspect typeguard is a recent dependency from inflect. CI is probably getting stale dependencies from somewhere.

@jaraco
Copy link
Member Author

jaraco commented Apr 16, 2024

Typeguard is coming from the dependency on jaraco.text:

jaraco.text==3.12.0
├── autocommand [required: Any, installed: 2.2.2]
├── inflect [required: Any, installed: 7.2.0]
│   ├── more-itertools [required: Any, installed: 10.2.0]
│   ├── typeguard [required: >=4.0.1, installed: 4.2.1]

@jaraco
Copy link
Member Author

jaraco commented Apr 16, 2024

Question is - should cheroot work to unpin the dependency on older pytest or fix the issue with typeguard?

@jaraco
Copy link
Member Author

jaraco commented Apr 16, 2024

pytest 6.2.5 is 2.5 years old.

@jaraco
Copy link
Member Author

jaraco commented Apr 16, 2024

The pin mentions #511

@webknjaz
Copy link
Member

Yes, pytest-forked is still unfixed: pytest-dev/pytest-forked#67. That's the reason pytest is old. I've was considering removing the use of this plugin but never got to figuring out if it can be replaced.

I'm working towards making a stable v11.0.0 release (tried out the release pipeline through pre-release versions but the changelog needs to be polished a bit and then I'll release). Until it's released, I'd rather not add anything on top. Hoping to complete this in the next few days (ASAP really).

@webknjaz
Copy link
Member

Question is - should cheroot work to unpin the dependency on older pytest or fix the issue with typeguard?

That's the plan.

@webknjaz
Copy link
Member

To give some context, the reason there's constraint files is that I figured that I value stability of the CI and transparency of the pin updates over testing against the latest versions. This also makes it easier on the PR authors since it's more predictable and easier to separate failures caused by PRs vs. failures caused by the broken CI. Since I implemented it, the CI here is exceptionally stable. But such constraints are sometimes need restrictions when incompatibilities cause problems. Those constraints are meant to be temporary and should be removed as soon as a solution is found.

Such old pins also start causing problems when other dependencies update and require newer versions of things. The recent example is #656 where upgrading inflect which is transitive to us, makes pytest explode, supposedly because it needs v7 or v8 — I haven't yet looked closer, being focused on the release-related things.

@webknjaz
Copy link
Member

webknjaz commented Apr 16, 2024

@jaraco are you on x86_64 or ARM64? I suspect the latter. Currently, the lockfiles are only made for the former. So the pip install wrapper integrated in tox doesn't pick up the constraint file and you're getting a pip install invocation without a -c — essentially an unconstrained test dependency install.

@jaraco
Copy link
Member Author

jaraco commented Apr 16, 2024

Yes, ARM64 (macOS on Apple Silicon).

@webknjaz
Copy link
Member

@jaraco you can make symlinks for the constraint files using the pattern @ https://github.com/cherrypy/cheroot/blob/9d4de6b/bin/pip_constraint_helpers.py#L68 (you'll need to use what sys.platform and platform.machine().lower() return in your runtime).

That's your immediate workaround. The deptree should be the same as for the x86_64 arch. I wish we could do this in CI properly but we'll have to wait until GH provides it to public.

@webknjaz
Copy link
Member

I've was considering removing the use of this plugin but never got to figuring out if it can be replaced.

IIRC I wanted some sort of isolation since the test messes up with process-global things. That's my vague recollection, at least, I don't remember exactly. I also have a commit bit on that plugin repo but it's way too complicated for me to figure out by myself.

webknjaz pushed a commit to webknjaz/cheroot that referenced this issue Apr 27, 2024
This plugin is incompatible with Pytest 7+, it's difficult to fix
upstream and there is no timeline for addressing that.

The patch also bumps the top version boundary of Pytest to 7.2 due
to the pinned `pytest-cov` raising warnings.

Fixes #cherrypy#502
Resolves cherrypy#511
Closes cherrypy#680
webknjaz pushed a commit to webknjaz/cheroot that referenced this issue Apr 27, 2024
This plugin is incompatible with Pytest 7+, it's difficult to fix
upstream and there is no timeline for addressing that.

The patch also bumps the top version boundary of Pytest to 7.2 due
to the pinned `pytest-cov` raising warnings.

Fixes #cherrypy#502
Resolves cherrypy#511
Closes cherrypy#680
Resolves cherrypy#681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants