run lint and fix errors, except mypy

This commit is contained in:
pacrob
2024-02-19 15:56:20 -07:00
parent 42605c0288
commit 94483714a3
171 changed files with 4809 additions and 2290 deletions

View File

@ -1,22 +1,29 @@
from pathlib import Path
from pathlib import (
Path,
)
import subprocess
from tempfile import TemporaryDirectory
from tempfile import (
TemporaryDirectory,
)
import venv
def create_venv(parent_path):
venv_path = parent_path / 'package-smoke-test'
venv_path = parent_path / "package-smoke-test"
venv.create(venv_path, with_pip=True)
subprocess.run([venv_path / 'bin' / 'pip', 'install', '-U', 'pip', 'setuptools'], check=True)
subprocess.run(
[venv_path / "bin" / "pip", "install", "-U", "pip", "setuptools"], check=True
)
return venv_path
def find_wheel(project_path):
wheels = list(project_path.glob('dist/*.whl'))
wheels = list(project_path.glob("dist/*.whl"))
if len(wheels) != 1:
raise Exception(
f"Expected one wheel. Instead found: {wheels} in project {project_path.absolute()}"
f"Expected one wheel. Instead found: {wheels} in project "
f"{project_path.absolute()}"
)
return wheels[0]
@ -29,11 +36,7 @@ def install_wheel(venv_path, wheel_path, extras=()):
extra_suffix = ""
subprocess.run(
[
venv_path / 'bin' / 'pip',
'install',
f"{wheel_path}{extra_suffix}"
],
[venv_path / "bin" / "pip", "install", f"{wheel_path}{extra_suffix}"],
check=True,
)
@ -41,12 +44,12 @@ def install_wheel(venv_path, wheel_path, extras=()):
def test_install_local_wheel():
with TemporaryDirectory() as tmpdir:
venv_path = create_venv(Path(tmpdir))
wheel_path = find_wheel(Path('.'))
wheel_path = find_wheel(Path("."))
install_wheel(venv_path, wheel_path)
print("Installed", wheel_path.absolute(), "to", venv_path)
print(f"Activate with `source {venv_path}/bin/activate`")
input("Press enter when the test has completed. The directory will be deleted.")
if __name__ == '__main__':
if __name__ == "__main__":
test_install_local_wheel()