Artur Dobrogowski
03/26/2024, 10:51 PMkedro new in 0.19.3 or use for example spaceflights-pandas - is it only me or those tests need more love?
1. running pytest in root dir or in tests dir does not work - it's not properly configured to find your main module. I needed to move tests dir to src/ to make it work or edit pyproject.toml
2. spaceflights-pandas still uses ConfigLoader which was removed and throws error. kedro new has OmegaConfig there and it works, but...
3. even then in both cases I get another error:
E TypeError: KedroContext.__init__() missing 1 required positional argument: 'env'
/home/adobrogo/projects/kedro/jupyter-lab/template-test/tests/test_run.py26 TypeErrorArtur Dobrogowski
03/26/2024, 10:52 PMArtur Dobrogowski
03/26/2024, 10:53 PMNok Lam Chan
03/26/2024, 11:08 PMNok Lam Chan
03/26/2024, 11:08 PMArtur Dobrogowski
03/26/2024, 11:12 PMNok Lam Chan
03/26/2024, 11:12 PMArtur Dobrogowski
03/26/2024, 11:12 PMArtur Dobrogowski
03/26/2024, 11:14 PMArtur Dobrogowski
03/26/2024, 11:14 PMenv="local", for exampleArtur Dobrogowski
03/26/2024, 11:14 PMArtur Dobrogowski
03/26/2024, 11:15 PMArtur Dobrogowski
03/26/2024, 11:19 PMsrc/ while in others it can'tArtur Dobrogowski
03/26/2024, 11:25 PMArtur Dobrogowski
03/26/2024, 11:35 PMArtur Dobrogowski
03/26/2024, 11:40 PMpip install . -e ---> poetry does that for you by default so that's why it was working in my other poetry setup
⢠add instruction that you can run it by going to src/ and then leveraging python -m pytest ../tests (and /or add tests to tests path in pyproject.toml )
⢠move tests dir to src/tests - that's what kedro docs page already assumes it to be - see https://docs.kedro.org/en/stable/development/automated_testing.html#run-your-tests
So I'd vote for 3rd option, as it requires the least knowledge about pytest mechanisms, but improving docs is also a must.
What do you think @Nok Lam Chan?Nok Lam Chan
03/26/2024, 11:43 PMNok Lam Chan
03/26/2024, 11:44 PMsrc because you don't want to ship your test to your user, they don't need this.
https://github.com/kedro-org/kedro-starters/tree/main/spaceflights-pandas/%7B%7B%20cookiecutter.repo_name%20%7D%7DYury Fedotov
03/26/2024, 11:49 PMtests outside of src?
Was that related to š§± ?Nok Lam Chan
03/26/2024, 11:52 PMtests outside of src is the norm. https://packaging.python.org/en/latest/tutorials/packaging-projects/#creating-the-package-filesNok Lam Chan
03/26/2024, 11:54 PMYury Fedotov
03/26/2024, 11:55 PMNok Lam Chan
03/26/2024, 11:56 PMit was helpful that Kedro violates the convention of keepingDid you mean Kedro created tests outside or inside ofoutside oftests?src
src?Yury Fedotov
03/26/2024, 11:58 PMRichard Purvis
03/27/2024, 12:08 AM