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

Fix tests and don't invoke setup.py directly #215

Merged
merged 1 commit into from
May 27, 2023
Merged

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented May 27, 2023

The merge of #211 failed the CI for Python 3.12:

https://github.com/jazzband/geojson/actions/runs/5098872321/jobs/9166263747

Run coverage run --branch --source=geojson setup.py test
Traceback (most recent call last):
  File "/home/runner/work/geojson/geojson/setup.py", line 1, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'

That's because the 3.12 beta removed setuptools from Python. We could install setuptools on the CI, but really we shouldn't be running tests via python setup.py test - we shouldn't invoke setup.py directly. See https://blog.ganssle.io/tag/setuptools.html for the long version.

Instead, let's modernise testing and use pytest and tox to run the tests.

So for example, tests can be run like:

python -m pip install pytest
pytest

Or with tox on all available Python versions:

python -m pip install tox
tox

Or a specific version:

tox -e py312

Or all in parallel:

tox -p auto

@codecov
Copy link

codecov bot commented May 27, 2023

Codecov Report

Merging #215 (b2d9166) into main (dbd83d8) will increase coverage by 0.51%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #215      +/-   ##
==========================================
+ Coverage   97.73%   98.25%   +0.51%     
==========================================
  Files          10       19       +9     
  Lines         353      801     +448     
  Branches       76        0      -76     
==========================================
+ Hits          345      787     +442     
- Misses          5       14       +9     
+ Partials        3        0       -3     

see 14 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rayrrr rayrrr self-requested a review May 27, 2023 23:38
@rayrrr rayrrr merged commit 3a3a1b3 into jazzband:main May 27, 2023
@hugovk hugovk deleted the fix-3.12 branch May 28, 2023 09:09
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Dec 9, 2023
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.

2 participants