Make selftest dialogue mutable
[mudpy.git] / mudpy / tests / selftest.py
index b1eb7cf..d5b8ac4 100644 (file)
@@ -11,6 +11,13 @@ import sys
 import telnetlib
 import time
 
+# TODO(fungi) Clean this up once Python 3.5 is no longer supported
+if sys.version < "3.6":
+    import collections
+    odict = collections.OrderedDict
+else:
+    odict = dict
+
 pidfile = "var/mudpy.pid"
 
 test_account0_setup = (
@@ -378,7 +385,7 @@ final_cleanup = (
     (2, r"Disconnecting\.\.\.", ""),
 )
 
-dialogue = (
+dialogue = odict((
     (test_account0_setup, "first account setup"),
     (test_account1_setup, "second account setup"),
     (test_actor_appears, "actor spontaneous appearance"),
@@ -423,7 +430,7 @@ dialogue = (
     (test_invalid_loglevel, "invalid loglevel"),
     (test_log_no_errors, "no errors logged"),
     (final_cleanup, "delete remaining accounts"),
-)
+))
 
 
 def start_service(config):
@@ -534,7 +541,8 @@ def main():
     for luser in lusers:
         luser.open("::1", 4000)
         luser.set_option_negotiation_callback(option_callback)
-    for test, description in dialogue:
+    selected_dialogue = odict(dialogue)
+    for test, description in selected_dialogue.items():
         tlog("\nTesting %s..." % description)
         test_start = time.time()
         for conversant, question, answer in test: