Skip to content

Commit

Permalink
Use the python path from virtualenv in end to end tests
Browse files Browse the repository at this point in the history
Signed-off-by: hemildesai <[email protected]>
  • Loading branch information
hemildesai committed Dec 22, 2020
1 parent 87a9c20 commit 6af24dd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions end-to-end-test/end_to_end_test/test_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import os
import subprocess
import pytest # type: ignore
from .utils import get_env

from .utils import get_env, PYTHON_PATH


@pytest.mark.parametrize(
Expand Down Expand Up @@ -69,7 +70,7 @@ def main():
)

env = get_env()
cmd = ["python", "train.py"]
cmd = [PYTHON_PATH, "train.py"]
subprocess.run(cmd, cwd=tmpdir, env=env, check=True)

experiments = json.loads(
Expand Down
4 changes: 2 additions & 2 deletions end-to-end-test/end_to_end_test/test_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path
import pytest # type: ignore

from .utils import path_exists, get_env
from .utils import path_exists, get_env, PYTHON_PATH


@pytest.mark.parametrize(
Expand Down Expand Up @@ -57,7 +57,7 @@ def main():
)

env = get_env()
cmd = ["python", "train.py", "--foo"]
cmd = [PYTHON_PATH, "train.py", "--foo"]
subprocess.run(cmd, cwd=tmpdir, env=env, check=True)

experiments = json.loads(
Expand Down
8 changes: 5 additions & 3 deletions end-to-end-test/end_to_end_test/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest # type: ignore
from dateutil.parser import parse as parse_date

from .utils import get_env
from .utils import get_env, PYTHON_PATH


@pytest.mark.parametrize(
Expand Down Expand Up @@ -58,7 +58,7 @@ def main():

env = get_env()

subprocess.run(["python", "train.py", "--foo"], cwd=tmpdir, env=env, check=True)
subprocess.run([PYTHON_PATH, "train.py", "--foo"], cwd=tmpdir, env=env, check=True)

experiments = json.loads(
subprocess.run(
Expand Down Expand Up @@ -106,7 +106,9 @@ def main():
experiment.checkpoint(path=".", step=3)
"""
)
subprocess.run(["python", "train2.py", exp["id"]], cwd=tmpdir, env=env, check=True)
subprocess.run(
[PYTHON_PATH, "train2.py", exp["id"]], cwd=tmpdir, env=env, check=True
)
experiments = json.loads(
subprocess.run(
["replicate", "--verbose", "list", "--json"],
Expand Down
1 change: 1 addition & 0 deletions end-to-end-test/end_to_end_test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from google.cloud import storage as google_storage

ROOT_DIRECTORY = Path(__file__).parent.parent.parent
PYTHON_PATH = os.path.abspath(os.path.join(ROOT_DIRECTORY, "venv/bin/python"))


def get_env():
Expand Down

0 comments on commit 6af24dd

Please sign in to comment.