[tor-commits] [chutney/master] TorNet: update getTests() for pathlib

nickm at torproject.org nickm at torproject.org
Sat Jul 18 15:41:23 UTC 2020


commit a17854bf98626854a918146e6536754c458bbf9b
Author: c <c at chroniko.jp>
Date:   Sun Jul 5 08:06:52 2020 +0000

    TorNet: update getTests() for pathlib
---
 lib/chutney/TorNet.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index f33cc42..b19c2f2 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -2542,11 +2542,10 @@ def ConfigureNodes(nodelist):
 def getTests():
     tests = []
     chutney_path = get_absolute_chutney_path()
-    if len(chutney_path) > 0 and chutney_path[-1] != '/':
-        chutney_path += "/"
-    for x in os.listdir(chutney_path + "scripts/chutney_tests/"):
-        if not x.startswith("_") and os.path.splitext(x)[1] == ".py":
-            tests.append(os.path.splitext(x)[0])
+    chutney_tests_path = chutney_path / "scripts" / "chutney_tests"
+    for x in chutney_tests_path.glob("*.py"):
+        if not x.startswith("_"):
+            tests.append(x.with_suffix(""))
     return tests
 
 





More information about the tor-commits mailing list