LUMC / pytest-workflow

Configure workflow/pipeline tests using yaml files.
https://pytest-workflow.readthedocs.io/en/stable/
GNU Affero General Public License v3.0
64 stars 9 forks source link

Feature request: Allow wildcard in path #188

Closed stianlagstad closed 11 months ago

stianlagstad commented 11 months ago

I have a test like this:

- name: "Test something"
  command: my_command
  files:
    - path: logfile.txt

But I want to change how I produce the logfile.txt so that the name includes the date, like this: logfile-2023-11-30.txt. This causes my above assertion to fail, but I'd still like to make this work somehow. I would like to do something like this:

- name: "Test something"
  command: my_command
  files:
    - path: logfile*.txt

Or similar. It would be very useful is some kind of wildcarding would work for path assertions.

rhpvorderman commented 11 months ago

That functionality is builtin in python, so that should be possible to implement. https://docs.python.org/3/library/glob.html

I wonder if in this case a custom test is not a better option. You can then check if the filepath has a date rather than matching everything.

stianlagstad commented 11 months ago

Thanks for responding. I solved this on my end so that I create the filename "log.txt" (excluding the date) when running tests, and the date-variant otherwise. Please feel free to close this.

rhpvorderman commented 11 months ago

Thank you for reporting back!