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

Fix e2e tests by distinguishing kedro-datasets dependency for different python versions #3802

Merged
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ package: clean install

install-test-requirements:
python -m pip install -U "pip>=21.2"
pip install .[test]
pip install -U .[test]

install-pre-commit:
pre-commit install --install-hooks
Expand Down
8 changes: 7 additions & 1 deletion features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import shutil
import subprocess
import sys
import tempfile
import venv
from pathlib import Path
Expand Down Expand Up @@ -130,6 +131,11 @@ def _install_project_requirements(context):
.splitlines()
)
install_reqs = [req for req in install_reqs if "{" not in req and "#" not in req]
install_reqs.append("kedro-datasets[pandas-csvdataset]")
# For Python versions 3.9 and above we use the new dataset dependency format introduced in `kedro-datasets` 3.0.0
if sys.version_info.minor > 8: # noqa: PLR2004
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we use a constant here to increase readability a bit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

install_reqs.append("kedro-datasets[pandas-csvdataset]")
# For Python 3.8 we use the older `kedro-datasets` dependency format
else:
install_reqs.append("kedro-datasets[pandas.CSVDataset]")
call([context.pip, "install", *install_reqs], env=context.env)
return context
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ ipython>=8.10
jupyterlab>=3.0
notebook
kedro~={{ cookiecutter.kedro_version}}
kedro-datasets[pandas-csvdataset]
kedro-datasets[pandas-csvdataset]; python_version >= "3.9"
kedro-datasets[pandas.CSVDataset]<2.0.0; python_version < '3.9'
kedro-telemetry>=0.3.1
pytest-cov~=3.0
pytest-mock>=1.7.1, <2.0
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ test = [
"jupyterlab_server>=2.11.1",
"jupyterlab>=3,<5",
"jupyter~=1.0",
"kedro-datasets",
"kedro-datasets; python_version >= '3.9'",
"kedro-datasets<2.0.0; python_version < '3.9'",
"mypy~=1.0",
"pandas~=2.0",
"pluggy>=1.0, <1.4", # pluggy 1.4 hide imports inside function and causing mocking issue
Expand Down