Add collect_include option to complement collect_ignore option.

Create issue
Issue #120 open
Sorin Ionuț Sbârnea created an issue

On big/huge project people may want to scan only some directories, and in order to obtain this the current collect_ignore list is not enough.

Adding tons of directories to collect_ignore may not be the best practice instead of just adding the locations you want to be scanned.

I would like to propose the addition of collect_include option that would allow only the files matching the patterns from it to be scanned.

Comments (4)

  1. Holger Krekel repo owner

    Could you provide some usage examples for the command line? If you are quick the option might make it to 1.3.4 which i plan to release in an hour or so :) cheers, holger

  2. Sorin Ionuț Sbârnea reporter

    I am new to py.test so I may request an already existing feature. Let me describe it better: if you call pytest without any arguments it will scan everything starting with the current directory.

    My feature request is to add a config option that would allow me to specify the list of locations to be scanned inside the `` file.

    This would allow me to call py.test without any parameter in the root of the project.

  3. Holger Krekel repo owner
    • changed status to open

    Ah, i see. Something like this would probably indeed make sense. Maybe we rather want to specify the "root" directories that should be considered for collecting tests like this:

    collect_roots = ['tests', ] 

    because you probably do not want to specify multiple file paths. Likely, collect_ignore should be considered afterwards then so that

    collect_roots = ['tests', ] 

    would work as expected (collect tests in 'tests' subdir but don't look into data directory). Does this make sense to you?

    And would it be ok if ``collect_root`` only works if it specified in a "root" file and not in any deeper nested sub directories?

  4. Sorin Ionuț Sbârnea reporter

    For me it would be ok because I use only one file, but later people may want to be able to address them in any file.

    One example would be when you include third party modules in your project. But this could be filed as another feature/bug later :D

  5. Log in to comment