[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit a17854bf98626854a918146e6536754c458bbf9b
Author: c <c@xxxxxxxxxxx>
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
 
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits