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

Support new python versions and upgrade pytest to 7.4.3 #717

Conversation

msabramo
Copy link
Contributor

@msabramo msabramo commented Oct 26, 2023

  • Please check if the PR fulfills these requirements
  • Tests for the changes have been added
  • Docs have been added / updated
  • All CI checks are green
  • What kind of change does this PR introduce?
    Adds support for new Python versions

  • What is the current behavior?
    Tests run only up to Python 3.9

  • What is the new behavior (if this is a feature change)?

    • Tests run up to Python 3.11
    • Upgrades pytest from 6.2.2 to 7.4.3 (this was necessary to prevent TypeError: required field "lineno" missing from alias errors that I was experiencing when testing with Python 3.10).
  • Does this PR introduce a breaking change?
    No.

  • Other information:

Without this, I get a `TypeError: required field "lineno" missing from alias` error with Python 3.10. E.g.:

```
$ tox -e py310
.pkg: _optional_hooks> python /Users/abramowi/Code/OpenSource/detect-secrets/.venv/lib/python3.10/site-packages/pyproject_api/_backend.py True
attrs==21.4.0
 setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /Users/abramowi/Code/OpenSource/detect-secrets/.venv/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_wheel> python /Users/abramowi/Code/OpenSource/detect-secrets/.venv/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: prepare_metadata_for_build_wheel> python /Users/abramowi/Code/OpenSource/detect-secrets/.venv/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_sdist> python /Users/abramowi/Code/OpenSource/detect-secrets/.venv/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
py310: install_package> python -I -m pip install --force-reinstall --no-deps /Users/abramowi/Code/OpenSource/detect-secrets/.tox/.tmp/package/4/detect_secrets-1.4.0.tar.gz
py310: commands[0]> coverage erase
py310: commands[1]> coverage run -m pytest --strict tests
ImportError while loading conftest '/Users/abramowi/Code/OpenSource/detect-secrets/tests/conftest.py'.
TypeError: required field "lineno" missing from alias
py310: exit 4 (0.16 seconds) /Users/abramowi/Code/OpenSource/detect-secrets> coverage run -m pytest --strict tests pid=74616
.pkg: _exit> python /Users/abramowi/Code/OpenSource/detect-secrets/.venv/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  py310: FAIL code 4 (1.43=setup[1.21]+cmd[0.06,0.16] seconds)
  evaluation failed :( (1.56 seconds)
```
@msabramo msabramo force-pushed the support-new-python-versions-and-upgrade-pytest-to-7.4.3 branch from 1ceda22 to 3fff375 Compare October 26, 2023 04:52
Copy link
Contributor

@gpflaum gpflaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked for me with Python 3.9 and 3.11.
Running tests now shows some additional warnings like the one below, where pytest warns that tests written for nose are deprecated:

tests/plugins/aws_key_test.py::TestAWSKeyDetector::test_analyze[aws_access_key = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYa"-False]
  /home/gpflaum/.local/lib/python3.9/site-packages/_pytest/fixtures.py:895: PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
  tests/plugins/aws_key_test.py::TestAWSKeyDetector::test_analyze[aws_access_key = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYa"-False] is using nose-specific method: `setup(self)`
  To remove this warning, rename it to `setup_method(self)`
  See docs: https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose
    fixture_result = next(generator)

@lorenzodb1
Copy link
Contributor

We added support for Python 3.10 and removed support for 3.7 in #724. We won't be supporting Python 3.11 yet as it's still in a bugfixes status.

@lorenzodb1 lorenzodb1 closed this Nov 15, 2023
@gpflaum
Copy link
Contributor

gpflaum commented Nov 16, 2023

@lorenzodb1 You might be misinterpreting the meaning of bugfix status for Python releases. That designation is for stable, maintenance releases. It would be appropriate for detect-secrets to support those releases. 3.11 was released over a year ago.

@lorenzodb1
Copy link
Contributor

@gpflaum good call, I'll look into it

@lorenzodb1
Copy link
Contributor

@gpflaum #730

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants