From f4cdf66c28d7c9861529f2ccad1c323d28a5d515 Mon Sep 17 00:00:00 2001 From: Jonathan van der Steege Date: Sun, 31 Jul 2022 00:06:12 +0200 Subject: [PATCH] Only check for files --- tests/lib/helpers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/lib/helpers.py b/tests/lib/helpers.py index 8df4137e..e3a4d70d 100644 --- a/tests/lib/helpers.py +++ b/tests/lib/helpers.py @@ -1,7 +1,6 @@ # Copyright (C) 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html -import fnmatch import functools import os @@ -23,7 +22,12 @@ def does_directory_contain_n_files(directory_path, number): if not os.path.isdir(directory_path): return False - count = len(fnmatch.filter(os.listdir(directory_path), "*.*")) + files = [ + f + for f in os.listdir(directory_path) + if os.path.isfile(os.path.join(directory_path, f)) + ] + count = len(files) return int(number) == count