summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Forbes <tom@tomforb.es>2018-11-04 23:56:46 +0000
committerTim Graham <timograham@gmail.com>2018-11-04 18:56:46 -0500
commitecac6d7a2a510cb0a5d772deeca633c99c9687e5 (patch)
tree16b0772bd9ee1b1069ace775ad50992197d92d02
parentd5e52f2befe8400817b23ecdbeb0ee28271ccf9d (diff)
Improved performance of runtests.py with os.scandir().
-rwxr-xr-xtests/runtests.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/runtests.py b/tests/runtests.py
index a410777203..8c30b9d802 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -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