Use Flit instead of Poetry for uninstall tests (#14285)

Investigating https://github.com/astral-sh/uv/issues/14158
This commit is contained in:
Zanie Blue 2025-06-26 13:09:04 -05:00 committed by GitHub
parent 8c27c2b494
commit 1ff8fc0947
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 201 additions and 16 deletions

View file

@ -176,7 +176,7 @@ fn uninstall_editable_by_name() -> Result<()> {
"-e {}", "-e {}",
context context
.workspace_root .workspace_root
.join("scripts/packages/poetry_editable") .join("scripts/packages/flit_editable")
.as_os_str() .as_os_str()
.to_str() .to_str()
.expect("Path is valid unicode") .expect("Path is valid unicode")
@ -187,22 +187,22 @@ fn uninstall_editable_by_name() -> Result<()> {
.assert() .assert()
.success(); .success();
context.assert_command("import poetry_editable").success(); context.assert_command("import flit_editable").success();
// Uninstall the editable by name. // Uninstall the editable by name.
uv_snapshot!(context.filters(), context.pip_uninstall() uv_snapshot!(context.filters(), context.pip_uninstall()
.arg("poetry-editable"), @r###" .arg("flit-editable"), @r###"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
Uninstalled 1 package in [TIME] Uninstalled 1 package in [TIME]
- poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable) - flit-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/flit_editable)
"### "###
); );
context.assert_command("import poetry_editable").failure(); context.assert_command("import flit_editable").failure();
Ok(()) Ok(())
} }
@ -216,7 +216,7 @@ fn uninstall_by_path() -> Result<()> {
requirements_txt.write_str( requirements_txt.write_str(
context context
.workspace_root .workspace_root
.join("scripts/packages/poetry_editable") .join("scripts/packages/flit_editable")
.as_os_str() .as_os_str()
.to_str() .to_str()
.expect("Path is valid unicode"), .expect("Path is valid unicode"),
@ -228,22 +228,22 @@ fn uninstall_by_path() -> Result<()> {
.assert() .assert()
.success(); .success();
context.assert_command("import poetry_editable").success(); context.assert_command("import flit_editable").success();
// Uninstall the editable by path. // Uninstall the editable by path.
uv_snapshot!(context.filters(), context.pip_uninstall() uv_snapshot!(context.filters(), context.pip_uninstall()
.arg(context.workspace_root.join("scripts/packages/poetry_editable")), @r###" .arg(context.workspace_root.join("scripts/packages/flit_editable")), @r###"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
Uninstalled 1 package in [TIME] Uninstalled 1 package in [TIME]
- poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable) - flit-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/flit_editable)
"### "###
); );
context.assert_command("import poetry_editable").failure(); context.assert_command("import flit_editable").failure();
Ok(()) Ok(())
} }
@ -257,7 +257,7 @@ fn uninstall_duplicate_by_path() -> Result<()> {
requirements_txt.write_str( requirements_txt.write_str(
context context
.workspace_root .workspace_root
.join("scripts/packages/poetry_editable") .join("scripts/packages/flit_editable")
.as_os_str() .as_os_str()
.to_str() .to_str()
.expect("Path is valid unicode"), .expect("Path is valid unicode"),
@ -269,23 +269,23 @@ fn uninstall_duplicate_by_path() -> Result<()> {
.assert() .assert()
.success(); .success();
context.assert_command("import poetry_editable").success(); context.assert_command("import flit_editable").success();
// Uninstall the editable by both path and name. // Uninstall the editable by both path and name.
uv_snapshot!(context.filters(), context.pip_uninstall() uv_snapshot!(context.filters(), context.pip_uninstall()
.arg("poetry-editable") .arg("flit-editable")
.arg(context.workspace_root.join("scripts/packages/poetry_editable")), @r###" .arg(context.workspace_root.join("scripts/packages/flit_editable")), @r###"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
Uninstalled 1 package in [TIME] Uninstalled 1 package in [TIME]
- poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable) - flit-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/flit_editable)
"### "###
); );
context.assert_command("import poetry_editable").failure(); context.assert_command("import flit_editable").failure();
Ok(()) Ok(())
} }

View file

@ -0,0 +1,162 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm-project.org/#use-with-ide
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

View file

@ -0,0 +1,6 @@
def main():
print("Hello world!")
if __name__ == "__main__":
main()

View file

@ -0,0 +1,17 @@
[project]
name = "flit-editable"
version = "0.1.0"
description = "Example Flit project"
authors = [
{name = "konstin", email = "konstin@mailbox.org"},
]
dependencies = []
requires-python = ">=3.11"
license = {text = "MIT"}
[project.scripts]
flit-editable = "flit_editable:main"
[build-system]
requires = ["flit_core>=3.4,<4"]
build-backend = "flit_core.buildapi"