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

kedro new --tools test creates invalid test setup #3966

Closed
noklam opened this issue Jun 25, 2024 · 0 comments
Closed

kedro new --tools test creates invalid test setup #3966

noklam opened this issue Jun 25, 2024 · 0 comments

Comments

@noklam
Copy link
Contributor

noklam commented Jun 25, 2024

Description

Related: #3954
Slack: https://linen-slack.kedro.org/t/22301026/question-is-there-an-extra-step-required-to-run-pytest-with-#661646b5-a2e7-4b77-a3db-ab585f408793

https://github.com/kedro-org/kedro-starters/blob/main/spaceflights-pandas-viz/%7B%7B%20cookiecutter.repo_name%20%7D%7D/tests/test_run.py#L27

@pytest.fixture
def config_loader():
    return OmegaConfigLoader(conf_source=str(Path.cwd()))

The config loader is using incorrect arguments.

Context

Steps to Reproduce

  1. kedro new --tools test --example yes -n kedro-project
  2. cd kedro-project
  3. pip install -e .
  4. pytest

Try to print out parameters and find that it loads incorrrect config (use with globals. for example)

Expected Result

The default test should have similar behavior as kedro new by default

Potential Solutions:

  • Fix the OmegaConfigLoader with the correct arguments, i.e.
@pytest.fixture
def config_loader():
    return OmegaConfigLoader(conf_source="conf",base_env="base", default_run_env="local")

The previous test has 2 mistakes:

  1. conf_source shouldn't be Path.cwd() but pointing to conf
  2. base_env & default_run_env are missing.

This solution works but the complication is we introduce these "default" argument which is invisible to Kedro Framework user. Should we do this or instead use KedroSession? IMO KedroSession will be more consistent and it respect all the custom settings built in settings.py.

We may have to update some documentation in the test as well.

Your Environment

  • Kedro version used (pip show kedro or kedro -V): 0.19.6
  • Python version used (python -V) 3.10
  • Operating system and version: MacOS
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant