pytask icon indicating copy to clipboard operation
pytask copied to clipboard

BUG: Inconsistent number of collected tasks when (sub)paths occur multiple times

Open timmens opened this issue 1 year ago • 2 comments

  • [x] I have checked that this issue has not already been reported.
  • [x] I have confirmed this bug exists on the latest version of pytask.
  • [ ] (optional) I have confirmed this bug exists on the main branch of pytask.

When setting multiple pytask paths with common subdirectories, the tasks in those subdirectories are counted twice in the collection. I have checked, and they are not being executed twice. (This was originally discovered by @ChristianZimpelmann.)

Code Sample, a copy-pastable example

pytask version: 0.5.0

$ cat pyproject.toml
[tool.pytask.ini_options]
paths = [
  ".",
  ".",
]
$ cat task_a.py
import random
from pathlib import Path

def task_a():
    Path(f"{random.randint(0, 10)}.txt").write_text("test")

Problem description

The first row says Collected 2 tasks, but in the Summary, it says 1 Collected tasks.

image

Expected Output

I believe there should be the same number of collected tasks. Additionally, if the verbosity level is high, one could consider printing a warning.

timmens avatar Jul 05 '24 10:07 timmens

Hi @timmens and @ChristianZimpelmann, nice catch! Thanks a lot!

I'm not sure where it fails right now, but we should generate all the paths we are collecting and then take a set of them.

If you want to start a PR, you are welcome. Otherwise, I will tackle it eventually. The error is not blocking anything right?

tobiasraabe avatar Jul 05 '24 11:07 tobiasraabe

No, it's not blocking anything; it's rather cosmetic.

I can try to tackle this but it could take a few weeks until I can work on this.

timmens avatar Jul 05 '24 12:07 timmens