Title: Use upgraded pip in test fixture virtual environment by EliahKagan · Pull Request #1864 · gitpython-developers/GitPython · GitHub
Open Graph Title: Use upgraded pip in test fixture virtual environment by EliahKagan · Pull Request #1864 · gitpython-developers/GitPython
X Title: Use upgraded pip in test fixture virtual environment by EliahKagan · Pull Request #1864 · gitpython-developers/GitPython
Description: A couple of GitPython's tests create their own virtual environments. One of those tests, test_installation, uses pip in it. But it does not upgrade pip in that virtual environment before using it, so an old version is often used. (The virtual environment is deliberately isolated, so pip being current in the environment used to run the tests is not sufficient.) This creates a problem with pip on Cygwin. pip vendors pytoml to read pyproject.toml files. But the version of pytoml vendored by some old versions of pip--including the one currently used in a virtual environment in which pip has not been upgraded--is apparently unable to parse some syntactically correct TOML, at least on some platforms. This was undetected because the contents of pyproject.toml on the main branch do not trigger the bug. This is the cause of the Cygwin test failure in #1862 (at a083e81). The failing test is test_installation; the detailed information on the failure begins here in the log. The key is these lines from the error message: pip._vendor.pytoml.core.TomlError: /tmp/pip-req-build-yjylhtt5/pyproject.toml(61, 1): msg WARNING: You are using pip version 19.2.3, however version 24.0 is available. Often, such warnings are unrelated to errors that precede them, but in this case the low version of pip really is the cause. Changing the VirtualEnvironment test fixture to upgrade pip when it creates a virtual environment where pip is going to be used is sufficient to fix the problem. This pull request makes that change. It also upgrades setuptools when the Python version is lower than 3.12, which is recommended to do. From Python 3.9 on, venv.create has an upgrade_deps parameter that would make all of this very straightforward...except that using that would make test_installation incompatible with Python 3.7 and Python 3.8 (including on systems other than Cygwin). So I ended up doing it manually instead. This pull request has the main branch in the upstream GitPython repository as its base, but I have also tested these changes on top of #1862 (as it stands currently, with a083e81 at its tip) and verified that they fix the problem reported there and allow all CI checks to pass, including the Cygwin test workflow and the linting workflow with Ruff. I'm not sure what the best way is to integrate the changes here and in #1862. This could be merged to main, and then #1862 could be updated. Or this could be merged, and #1862 merged without updating it, trusting that the checks would go green on the main branch. Or the changes here could be replayed there (e.g., by fast-forwarding it to my ruff-pip-toml branch), or that could be merged first with the failing check and then this could be merged, etc. (I have no objection if these changes are integrated in a way results in this pull request itself being closed without merging.)
Open Graph Description: A couple of GitPython's tests create their own virtual environments. One of those tests, test_installation, uses pip in it. But it does not upgrade pip in that virtual environment before using ...
X Description: A couple of GitPython's tests create their own virtual environments. One of those tests, test_installation, uses pip in it. But it does not upgrade pip in that virtual environment before us...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/1864
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:b872e751-3853-64a0-7276-928dbb961076 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B8EA:DC416:4B93BF:6B8779:6968B730 |
| html-safe-nonce | eb14c6f3413582191dacd3d502c7ea472224cfef6bc3d59ef8fcc2690d0db08b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOEVBOkRDNDE2OjRCOTNCRjo2Qjg3Nzk6Njk2OEI3MzAiLCJ2aXNpdG9yX2lkIjoiNTcxNDY2ODkwOTI1OTk2MjE2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 25cdd852a6e2e53cd5d43cef64291457720924be447af3badf9efa0c6cf5b2ad |
| hovercard-subject-tag | pull_request:1766392768 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/1864/files |
| twitter:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| og:image:alt | A couple of GitPython's tests create their own virtual environments. One of those tests, test_installation, uses pip in it. But it does not upgrade pip in that virtual environment before using ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | fdc7c66bd36a6c12eb8e771e806db863266e573fc299e77f27505a768d4f8a98 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3223a6503d318917691422cdadfbe16cd8fb21e5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width