-
Notifications
You must be signed in to change notification settings - Fork 61
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
Pin Pip and fix lint e2e tests #201
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
42a8f32
Remove the installation step for lint e2e
noklam 777898f
Pin pip version to avoid package installation issue
noklam 00bd3cf
Pin pip in e2e test before scenario
noklam 319e381
fix order
noklam e308490
bug fix
noklam fbf5d72
fix gitpod
noklam 73dd29f
remove docker, a simple python 3.10 image is enough
noklam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,63 @@ | ||
"""Behave environment setup commands""" | ||
from __future__ import annotations | ||
|
||
import os | ||
import shlex | ||
import shutil | ||
import subprocess | ||
import tempfile | ||
import venv | ||
from pathlib import Path | ||
|
||
from typing import Set | ||
from typing import Any, Set | ||
|
||
_PATHS_TO_REMOVE: Set[Path] = set() | ||
|
||
|
||
|
||
|
||
def run( | ||
cmd: list | str, split: bool = True, print_output: bool = False, **kwargs: Any | ||
) -> subprocess.CompletedProcess: | ||
"""Run a shell command. | ||
|
||
Args: | ||
cmd: A command string, or a command followed by program | ||
arguments that will be submitted to Popen to run. | ||
|
||
split: Flag that splits command to provide as multiple *args | ||
to Popen. Default is True. | ||
|
||
print_output: If True will print previously captured stdout. | ||
Default is False. | ||
|
||
**kwargs: Extra options to pass to subprocess. | ||
|
||
Example: | ||
:: | ||
"ls" | ||
"ls -la" | ||
"chmod 754 local/file" | ||
|
||
Returns: | ||
Result with attributes args, returncode, stdout and stderr. | ||
|
||
""" | ||
if isinstance(cmd, str) and split: | ||
cmd = shlex.split(cmd) | ||
result = subprocess.run(cmd, input="", capture_output=True, **kwargs) # noqa: PLW1510 | ||
result.stdout = result.stdout.decode("utf-8") | ||
result.stderr = result.stderr.decode("utf-8") | ||
if print_output: | ||
print(result.stdout) | ||
return result | ||
|
||
def call(cmd, env): | ||
res = run(cmd, env=env) | ||
if res.returncode: | ||
print(res.stdout) | ||
print(res.stderr) | ||
assert False | ||
|
||
def create_new_venv() -> Path: | ||
"""Create a new venv. | ||
Returns: | ||
|
@@ -34,6 +80,7 @@ def before_scenario(context, scenario): | |
"""Environment preparation before each test is run.""" | ||
kedro_install_venv_dir = create_new_venv() | ||
context.venv_dir = kedro_install_venv_dir | ||
context.env = os.environ.copy() | ||
|
||
if os.name == "posix": | ||
bin_dir = context.venv_dir / "bin" | ||
|
@@ -45,6 +92,21 @@ def before_scenario(context, scenario): | |
context.kedro = str(bin_dir / "kedro") | ||
context.python = str(bin_dir / "python") | ||
|
||
# Fix Pip version | ||
call( | ||
[ | ||
context.python, | ||
"-m", | ||
"pip", | ||
"install", | ||
"-U", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: No need to do |
||
# pip==23.3 breaks dependency resolution | ||
"pip==23.2", | ||
], | ||
env=context.env, | ||
) | ||
|
||
|
||
starters_root = Path(__file__).parents[1] | ||
starter_names = [ | ||
"astro-airflow-iris", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this more or less
check_output
? https://docs.python.org/3/library/subprocess.html#subprocess.check_outputThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk of code is borrowed from Kedro repo.