From 021e843427c6f5e79ee4a5b47ef3015599292822 Mon Sep 17 00:00:00 2001 From: Andreas Pelme Date: Sat, 17 Dec 2016 14:21:44 +0100 Subject: [PATCH] Fixed #2121 Use `py.path`s fnmatch. This fixes an issue where python_files handled properly when rewriting assertions. --- _pytest/assertion/rewrite.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index f7e255efd..79943cc53 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -11,7 +11,6 @@ import re import struct import sys import types -from fnmatch import fnmatch import py from _pytest.assertion import util @@ -167,7 +166,7 @@ class AssertionRewritingHook(object): # latter might trigger an import to fnmatch.fnmatch # internally, which would cause this method to be # called recursively - if fnmatch(fn_pypath.basename, pat): + if fn_pypath.fnmatch(pat): state.trace("matched test file %r" % (fn,)) return True