@@ -198,17 +198,18 @@ def pytest_collect_file(path, parent):
198
198
rel_path = get_rel_path (path .strpath , parent .session .fspath .strpath )
199
199
session = parent .session
200
200
if session .pylint_config is None :
201
- session .pylint_files .add (rel_path )
202
201
# No pylintrc, therefore no ignores, so return the item.
203
- return PyLintItem (path , parent )
204
-
205
- if include_file (rel_path , session .pylint_ignore ,
206
- session .pylint_ignore_patterns ):
207
- session .pylint_files .add (rel_path )
208
- return PyLintItem (
202
+ item = PyLintItem (path , parent )
203
+ elif include_file (rel_path , session .pylint_ignore ,
204
+ session .pylint_ignore_patterns ):
205
+ item = PyLintItem (
209
206
path , parent , session .pylint_msg_template , session .pylintrc_file
210
207
)
211
- return None
208
+ else :
209
+ return None
210
+ if not item .should_skip :
211
+ session .pylint_files .add (rel_path )
212
+ return item
212
213
213
214
214
215
def pytest_collection_finish (session ):
@@ -268,11 +269,12 @@ def __init__(self, fspath, parent, msg_format=None, pylintrc_file=None):
268
269
269
270
self .pylintrc_file = pylintrc_file
270
271
self .__mtime = self .fspath .mtime ()
272
+ prev_mtime = self .config .pylint .mtimes .get (self .nodeid , 0 )
273
+ self .should_skip = (prev_mtime == self .__mtime )
271
274
272
275
def setup (self ):
273
276
"""Mark unchanged files as SKIPPED."""
274
- previous = self .config .pylint .mtimes .get (self .nodeid , 0 )
275
- if previous == self .__mtime :
277
+ if self .should_skip :
276
278
pytest .skip ("file(s) previously passed pylint checks" )
277
279
278
280
def runtest (self ):
0 commit comments