From 2bf8484793b4d6491b7606a7c82aa750ec7c5cf2 Mon Sep 17 00:00:00 2001 From: Eduardo Elael Date: Tue, 15 Mar 2022 15:01:48 +0100 Subject: [PATCH] Fix glob matching the output of `pathlib.Path.glob` is a generator. So it was always evaluating to true. --- pytest_flakes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pytest_flakes.py b/pytest_flakes.py index 77c7028..58fabe0 100644 --- a/pytest_flakes.py +++ b/pytest_flakes.py @@ -6,6 +6,7 @@ import pytest import sys import tokenize +import fnmatch PYTEST_GTE_7 = hasattr(pytest, 'version_tuple') and pytest.version_tuple >= (7, 0) @@ -148,7 +149,7 @@ def __init__(self, ignorelines, coderex=re.compile(r"[EW]\d\d\d")): def __call__(self, path): l = set() for (glob, ignlist) in self.ignores: - if not glob or path.glob(glob): + if not glob or fnmatch.fnmatch(path, glob): if ignlist is None: return None l.update(set(ignlist))