the surfer
the surfer

Reputation: 81

Unable to exclude directories with the builtin configuration file options - pytest

Following the pytest docs, I created a file in the project's root directory called "setup.cfg" with the following contents:

[pytest]
norecursedirs = tmp* 

This works fine; calling --collect-only shows that all folders prefixed with "tmp" are ignored.

However, when I change tmp* to [!tmp] nothing happens ("nothing" as in calling --collect-only shows that all tests are displayed regardless of folder location.) perhaps I have the wrong syntax or the wrong idea of what "[!seq]" is supposed to do...?

So, my question - how do I specify norecursedirs to ignore everything except tmp (as an example).

Upvotes: 0

Views: 311

Answers (1)

hpk42
hpk42

Reputation: 23601

I guess you would need to specify [!t]* to only recurse into directories that start with t. In general, it appears to be hard to specify negative patterns with fnmatch-style glob matching. fnmatch docs contains more info but i guess you saw that already.

Upvotes: 1

Related Questions