Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
also look at ftests
Browse files Browse the repository at this point in the history
  • Loading branch information
dobe committed Mar 27, 2007
1 parent 7fd4311 commit 8610de3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions importchecker.py
@@ -1,3 +1,4 @@
#!/usr/bin/env python2.4
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
Expand Down Expand Up @@ -123,7 +124,6 @@ def getPath(self):
def getImportedModuleNames(self):
"""Return the names of imported modules.
"""

return self._map.keys()

def getImportNames(self):
Expand Down Expand Up @@ -260,7 +260,9 @@ def getImportedModuleNames(self, tests=False):
import os
for path, module in self._modules.items():
# remove .py
isTest = 'tests' in path[:-3].split(os.path.sep)
parts = path[:-3].split(os.path.sep)
isTest = 'tests' in parts or 'testing' in parts \
or 'ftests' in parts
if (tests and isTest) or (not tests and not isTest):
result.update(module.getImportedModuleNames())
return sorted(result)
Expand Down Expand Up @@ -291,7 +293,7 @@ def main():
try:
path = os.path.abspath(sys.argv[1])
except IndexError:
path = os.path.abspath(os.path.dirname(__file__))
path = os.path.abspath(os.getcwd())
path = os.path.join(path, 'src')

if not os.path.exists(path):
Expand Down Expand Up @@ -336,7 +338,7 @@ def main():
print "-"*80
print
print "-"*80
print "Imports only in tests"
print "Imports for 'tests' and 'testing' packages"
print "-"*80
for name in [name for name in testImports if name not in installImports]:
print name
Expand Down

0 comments on commit 8610de3

Please sign in to comment.