Skip to content

Commit

Permalink
Improved performance of runtests.py with os.scandir().
Browse files Browse the repository at this point in the history
  • Loading branch information
orf authored and timgraham committed Nov 4, 2018
1 parent d5e52f2 commit ecac6d7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ def get_test_modules():
SUBDIRS_TO_SKIP.append('gis_tests')

for modpath, dirpath in discovery_paths:
for f in os.listdir(dirpath):
if ('.' not in f and
os.path.basename(f) not in SUBDIRS_TO_SKIP and
not os.path.isfile(f) and
os.path.exists(os.path.join(dirpath, f, '__init__.py'))):
modules.append((modpath, f))
for f in os.scandir(dirpath):
if ('.' not in f.name and
os.path.basename(f.name) not in SUBDIRS_TO_SKIP and
not f.is_file() and
os.path.exists(os.path.join(f.path, '__init__.py'))):
modules.append((modpath, f.name))
return modules


Expand Down

0 comments on commit ecac6d7

Please sign in to comment.