Skip to content

Proposing a new flag, --list-of-files-or-dirs, to compliment the positional file_or_dir argument #11871

@jbkkd

Description

@jbkkd

What's the problem this feature will solve?

Passing a long list of test files/dirs into the pytest CLI can make reading the pytest command confusing.

Describe the solution you'd like

A new flag, --list-of-files-or-dirs, to compliment the positional file_or_dir argument.

The new flag will accept a single text file, with each line in the file representing a positional argument to pytest.

So, instead of calling pytest like this:
pytest test_file1.py test_file2.py test_file3.py ...
One would call:
pytest --list-of-files-or-dirs list_file.txt
With list_file.txt containing:

test_file1.py
test_file2.py
test_file3.py
...

Alternative Solutions

You can currently just call pytest with a list of all the files/dirs you want to test, but a long list passed through the CLI isn't such a clean interface.

Additional context

Happy to work take a stab at working on this if there's consensus that such a PR would be accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: help wanteddevelopers would like help from experts on this topictype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions