Skip to content

Commit

Permalink
Add types to release script
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Apr 13, 2020
1 parent b8bc444 commit 737f5a7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions web3/scripts/release/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
from tempfile import (
TemporaryDirectory,
)
from typing import (
Tuple,
)
import venv


def create_venv(parent_path):
def create_venv(parent_path: Path) -> Path:
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)
return venv_path


def find_wheel(project_path):
def find_wheel(project_path: Path) -> Path:
wheels = list(project_path.glob('dist/*.whl'))

if len(wheels) != 1:
Expand All @@ -26,7 +29,9 @@ def find_wheel(project_path):
return wheels[0]


def install_wheel(venv_path, wheel_path, extras=()):
def install_wheel(
venv_path: Path, wheel_path: Path, extras: Tuple[str, ...] = ()
) -> None:
if extras:
extra_suffix = f"[{','.join(extras)}]"
else:
Expand All @@ -42,7 +47,7 @@ def install_wheel(venv_path, wheel_path, extras=()):
)


def test_install_local_wheel():
def test_install_local_wheel() -> None:
with TemporaryDirectory() as tmpdir:
venv_path = create_venv(Path(tmpdir))
wheel_path = find_wheel(Path('.'))
Expand Down

0 comments on commit 737f5a7

Please sign in to comment.