-
Notifications
You must be signed in to change notification settings - Fork 903
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
Rewrite starter tests + update docs #3954
Comments
Thanks @yury-fedotov for reporting this, I'll add it to the backlog since the solution in #3958 is not ideal. ContextChanges in 0.19 PR #3300 changed the ordering of the arguments to I tried adding a default value to The fix probably needs to be in the starters for now.
|
Thanks @ankatiyar ! I agree that the change should be in the starter, not in the framework. However I'm curious why not keep the test and just specify In other words, change the code of the test fixture rather than the constructor of the context. That would allow to keep the test and close this specific issue with minimal changes. |
@yury-fedotov I think the change should go to starter, and I don't like the current test example. I just found another problem #3966 with the current test. My point is I prefer fixing the test example altogether rather than just the specific @pytest.fixture
def config_loader():
return OmegaConfigLoader(conf_source=str(Path.cwd()))
@pytest.fixture
def project_context(config_loader):
return KedroContext(
package_name="{{ cookiecutter.python_package }}",
project_path=Path.cwd(),
config_loader=config_loader,
hook_manag I find this weird, because usually I expect two common way to do this:
with KedroSession.create(...) as session:
context = session.load_context()
config_loader = context.config_loader
... This way you have the
@pytest.fixture
def config_loader():
return OmegaConfigLoader(conf_source="conf",base_env="base", default_run_env="local") In this case, |
@noklam shall we create an issue on the starters repo to address these two issues together? |
kedro new
project fails starter test at KedroContext
initialization
Use these docs as inspiration for the new tests: https://docs.kedro.org/en/stable/tutorial/test_a_project.html Update these docs to correspond to the test changes: https://docs.kedro.org/en/stable/development/automated_testing.html#create-an-example-test |
Some extra context: https://linen-slack.kedro.org/t/22301026/question-is-there-an-extra-step-required-to-run-pytest-with-#661646b5-a2e7-4b77-a3db-ab585f408793. The tests should ideally make use of the project settings and not hard-code too much, so they also show users how the configuration loading works. Long story short: not too much mocking and no hard-coding. |
Description
This:
Fails the only unit test because a
KedroContext
requiresenv
argument to be supplied.Context
I resolved it for my project by specifying
env=None
there, but it should work out of the box from the starter.Steps to Reproduce
kedro new
with all defaults except pysparkpip install -e .
pytest
Your Environment
pip show kedro
orkedro -V
): 0.19.6python -V
): 3.10The text was updated successfully, but these errors were encountered: