From 35a769f15e01b5bcfe7ac96ef39a6d46ff32d35c Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Tue, 17 Dec 2024 12:17:46 +0000
Subject: [PATCH] MNT: Ignore any candidate tests within output/benchmark/input
 data directories, in case any of those are contained within the test
 directories

---
 pyfeeds/main.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pyfeeds/main.py b/pyfeeds/main.py
index 6599853..652a2eb 100755
--- a/pyfeeds/main.py
+++ b/pyfeeds/main.py
@@ -62,6 +62,7 @@ upon which sub-command the user has specified:
 
 import os.path as op
 import            os
+import pathlib as pl
 import            sys
 import            logging
 import            fnmatch
@@ -226,10 +227,20 @@ class Pyfeeds:
 
         testDirs = functools.reduce(lambda a, b: a + b, testDirs)
         testDirs = sorted(set(testDirs))
+        testDirs = [op.abspath(td) for td in testDirs]
 
         if len(testDirs) == 0:
             return []
 
+        # Do not consider anything within the
+        # input, benchmark, or output directories
+        indir    = pl.Path(op.abspath(self.inputDir))
+        bmdir    = pl.Path(op.abspath(self.benchmarkDir))
+        outdir   = pl.Path(op.abspath(self.outputDir))
+        testDirs = [td for td in testDirs if indir  not in pl.Path(td).parents]
+        testDirs = [td for td in testDirs if bmdir  not in pl.Path(td).parents]
+        testDirs = [td for td in testDirs if outdir not in pl.Path(td).parents]
+
         # Find the deepest directory in
         # the file system which contains
         # all of the detected tests.
-- 
GitLab