Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up e2e-tests locally by skipping environment setup #3527

Merged
merged 5 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ show-coverage:
e2e-tests:
behave --tags=-skip

e2e-tests-fast: export BEHAVE_LOCAL_ENV=TRUE
e2e-tests-fast:
behave --tags=-skip --no-capture
noklam marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines +23 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be

Suggested change
e2e-tests-fast: export BEHAVE_LOCAL_ENV=TRUE
e2e-tests-fast:
behave --tags=-skip --no-capture
e2e-tests-fast:
BEHAVE_LOCAL_ENV=TRUE behave --tags=-skip --no-capture

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this but it doesn't work. I am not an expert of Makefile so I am happy with change if you found a fix.

image


pip-compile:
pip-compile -q -o -

Expand Down
49 changes: 31 additions & 18 deletions features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import shutil
import subprocess
import tempfile
import venv
from pathlib import Path
Expand Down Expand Up @@ -93,27 +94,39 @@ def _create_tmp_dir() -> Path:


def _setup_minimal_env(context):
kedro_install_venv_dir = _create_new_venv()
context.kedro_install_venv_dir = kedro_install_venv_dir
context = _setup_context_with_venv(context, kedro_install_venv_dir)
call(
[
context.python,
"-m",
"pip",
"install",
"-U",
# pip==23.2 breaks pip-tools<7.0, and pip-tools>=7.0 does not support Python 3.7
# pip==23.3 breaks dependency resolution
"pip>=21.2,<23.2",
],
env=context.env,
)
call([context.python, "-m", "pip", "install", "-e", "."], env=context.env)
return context
if os.environ.get("BEHAVE_LOCAL_ENV"):
output = subprocess.check_output(
["which", "kedro"] # noqa: S603, S607
) # equivalent run "which kedro"
output = output.strip().decode("utf8")
kedro_install_venv_dir = Path(output).parent.parent
context.kedro_install_venv_dir = kedro_install_venv_dir
context = _setup_context_with_venv(context, kedro_install_venv_dir)
return context
else:
kedro_install_venv_dir = _create_new_venv()
context.kedro_install_venv_dir = kedro_install_venv_dir
context = _setup_context_with_venv(context, kedro_install_venv_dir)

call(
[
context.python,
"-m",
"pip",
"install",
"-U",
# pip==23.2 breaks pip-tools<7.0, and pip-tools>=7.0 does not support Python 3.7
# pip==23.3 breaks dependency resolution
"pip>=21.2,<23.2",
],
env=context.env,
)
call([context.python, "-m", "pip", "install", "-e", "."], env=context.env)
return context


def _install_project_requirements(context):
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not!

install_reqs = (
Path("kedro/templates/project/{{ cookiecutter.repo_name }}/requirements.txt")
.read_text(encoding="utf-8")
Expand Down
Loading