Skip to content

Directory included in pattern matching is confusingΒ #29

@djmarcin

Description

@djmarcin

The documentation states that "These tests define a directory to scan for test data, a pattern (a regular expression) to match". However it doesn't make clear that the directory string must match the pattern and also is not automatically prepended to template filenames. This seems like an unexpected choice since the directory appears to be a prefix to the pattern / template definitions.

For example, given a configuration like this, nothing will ever match because the input pattern does not match "src/foo/tests".

#[datatest::files("src/foo/tests", {
    input in r"^(test_.*).in.yml",
    output = r"${1}.out.yml",
})]

Intuitively, the input pattern seems like it should be relative to the directory that is being searched. I was left scratching my head as to why this pattern wasn't matching anything, so at the very least this behavior should be documented. Although it would potentially be a disruptive change, I think it would greatly improve usability if the regex & file templates were applied rooted at the given directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions