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 pipeline create create tests folder inside src #3711

Closed
bpmeek opened this issue Mar 13, 2024 · 6 comments
Closed

kedro pipeline create create tests folder inside src #3711

bpmeek opened this issue Mar 13, 2024 · 6 comments
Labels
Issue: Bug Report 🐞 Bug that needs to be fixed

Comments

@bpmeek
Copy link

bpmeek commented Mar 13, 2024

Description

The test directory created by a new starter and the test directory created by a new pipeline don't match.

Context

Having multiple test locations can be confusing and difficult to manage.

Steps to Reproduce

  1. Create a new project with cli using kedro new
  2. Select tool 2 (Test) when asked for Project Tools
  3. Create a new pipeline with cli using `kedro pipeline create <pipeline_name>

Expected Result

Creating a new project creates <repo_name>/tests directory. Creating a new pipeline creates the following:

  • <repo_name>/tests/pipelines/<pipeline_name>/__init__.py
  • <repo_name>/tests/pipelines/<pipeline_name>/test_pipeline.py

Actual Result

Creating a new project creates <repo_name>/tests directory. Creating a new pipeline creates the following:

  • <repo_name>/src/tests/pipelines/<pipeline_name>/__init__.py
  • <repo_name>/src/tests/pipelines/<pipeline_name>/test_pipeline.py
-- If you received an error, place it here.
-- Separate them if you have more than one.

Your Environment

  • Kedro version used (pip show kedro or kedro -V): 0.19.3
  • Python version used (python -V): 3.10.13
  • Operating system and version: Mac OS 14.3.1
@noklam
Copy link
Contributor

noklam commented Mar 13, 2024

@bpmeek Can you provide some command /screenshot for us to reproduce? I did this just now and work as expected. I think you were talking test should be created in the same directory of src instead of inside it?

image

@bpmeek
Copy link
Author

bpmeek commented Mar 13, 2024

@noklam this is what I get, but yes, I would expect the tests directory to be in the same directory as src not inside of it. You can see below kedro pipeline create dummy_pipeline creates /Users/brandonmeek/dummy-project/src/tests/pipelines/dummy_pipeline/test_pipeline.py

(dummy-project) brandonmeek@MacBook-Pro ~ % kedro new --name=dummy-project --tools=test --example=n

Congratulations!
Your project 'dummy-project' has been created in the directory 
/Users/brandonmeek/dummy-project

You have selected the following project tools: ['Testing']
(dummy-project) brandonmeek@MacBook-Pro ~ % tree dummy-project 
dummy-project
├── README.md
├── conf
│   ├── README.md
│   ├── base
│   │   ├── catalog.yml
│   │   └── parameters.yml
│   └── local
│       └── credentials.yml
├── notebooks
├── pyproject.toml
├── requirements.txt
├── src
│   └── dummy_project
│       ├── __init__.py
│       ├── __main__.py
│       ├── pipeline_registry.py
│       ├── pipelines
│       │   └── __init__.py
│       └── settings.py
└── tests
    ├── __init__.py
    ├── pipelines
    │   └── __init__.py
    └── test_run.py

10 directories, 15 files
(dummy-project) brandonmeek@MacBook-Pro ~ % cd dummy-project 
(dummy-project) brandonmeek@MacBook-Pro dummy-project % kedro pipeline create dummy_pipeline
Using pipeline template at: '/Users/brandonmeek/opt/anaconda3/envs/dummy-project/lib/python3.10/site-packages/kedro/templates/pipeline'
Creating the pipeline 'dummy_pipeline': OK
  Location: '/Users/brandonmeek/dummy-project/src/dummy_project/pipelines/dummy_pipeline'
Creating '/Users/brandonmeek/dummy-project/src/tests/pipelines/dummy_pipeline/__init__.py': OK
Creating '/Users/brandonmeek/dummy-project/src/tests/pipelines/dummy_pipeline/test_pipeline.py': OK
Creating '/Users/brandonmeek/dummy-project/conf/base/parameters_dummy_pipeline.yml': OK

Pipeline 'dummy_pipeline' was successfully created.

(dummy-project) brandonmeek@MacBook-Pro dummy-project % tree
.
├── README.md
├── conf
│   ├── README.md
│   ├── base
│   │   ├── catalog.yml
│   │   ├── parameters.yml
│   │   └── parameters_dummy_pipeline.yml
│   └── local
│       └── credentials.yml
├── notebooks
├── pyproject.toml
├── requirements.txt
├── src
│   ├── dummy_project
│   │   ├── __init__.py
│   │   ├── __main__.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-310.pyc
│   │   │   └── settings.cpython-310.pyc
│   │   ├── pipeline_registry.py
│   │   ├── pipelines
│   │   │   ├── __init__.py
│   │   │   └── dummy_pipeline
│   │   │       ├── __init__.py
│   │   │       ├── nodes.py
│   │   │       └── pipeline.py
│   │   └── settings.py
│   └── tests
│       └── pipelines
│           └── dummy_pipeline
│               ├── __init__.py
│               └── test_pipeline.py
└── tests
    ├── __init__.py
    ├── pipelines
    │   └── __init__.py
    └── test_run.py

15 directories, 23 files

@noklam
Copy link
Contributor

noklam commented Mar 13, 2024

@bpmeek oh, I didn't get it correctly in the beginning, so it's the kedro pipeline create producing the unexpected test folder

@noklam
Copy link
Contributor

noklam commented Mar 14, 2024

@bpmeek I can confirm this behavior and I have updated the title. I will make sure this is discussed in the team soon.

@noklam noklam changed the title Pipeline test directory mismatch kedro pipeline create create tests folder inside src Mar 14, 2024
@noklam noklam added the Issue: Bug Report 🐞 Bug that needs to be fixed label Mar 14, 2024
@merelcht
Copy link
Member

I think this is a duplicate of #3614. If so, we'll close this issue and prioritise #3614 for our next sprint.

@bpmeek
Copy link
Author

bpmeek commented Mar 14, 2024

@merelcht it is a duplicate, I must've missed that ticket when I was looking.

Thank you!

@bpmeek bpmeek closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Bug Report 🐞 Bug that needs to be fixed
Projects
Archived in project
Development

No branches or pull requests

3 participants