Skip to content

Commit 60b784a

Browse files
committed
Python: Don't filter subclass tests away
1 parent a9a0216 commit 60b784a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

python/ql/lib/semmle/python/frameworks/internal/SubclassFinder.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ module NotExposed {
113113
}
114114

115115
predicate isAllowedModule(Module mod) {
116+
// for tests
117+
mod.getName() = "find_subclass_test"
118+
or
116119
// don't include anything found in site-packages
117120
exists(mod.getFile().getRelativePath()) and
118121
not mod.getFile().getRelativePath().regexpMatch("(?i)((^|/)examples?|^docs)/.*") and

python/ql/src/meta/ClassHierarchy/Find.ql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,5 +514,9 @@ where
514514
) and
515515
fullyQualifiedToYamlFormat(newModelFullyQualified, type2, path) and
516516
not Extensions::typeModel(spec, type2, path) and
517-
not newModelFullyQualified.regexpMatch("(?i).*tests?_?.*")
517+
(
518+
not newModelFullyQualified.regexpMatch("(?i).*tests?_?.*")
519+
or
520+
type2 = "find_subclass_test"
521+
)
518522
select spec.(string), type2, path

0 commit comments

Comments
 (0)