summaryrefslogtreecommitdiff
path: root/testsuite/driver
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/driver')
-rw-r--r--testsuite/driver/my_typing.py7
-rw-r--r--testsuite/driver/perf_notes.py2
-rw-r--r--testsuite/driver/testglobals.py2
-rw-r--r--testsuite/driver/testlib.py2
-rw-r--r--testsuite/driver/typing_stubs.py23
5 files changed, 31 insertions, 5 deletions
diff --git a/testsuite/driver/my_typing.py b/testsuite/driver/my_typing.py
index a31775d7f2..c3f3e02fe7 100644
--- a/testsuite/driver/my_typing.py
+++ b/testsuite/driver/my_typing.py
@@ -24,8 +24,11 @@ except:
# is taken. We exploit this below.
# TextIO is missing on some older Pythons.
-if 'TextIO' in globals():
- TextIO = typing.TextIO
+if 'TextIO' not in globals():
+ try:
+ TextIO = typing.TextIO
+ except ImportError:
+ TextIO = None # type: ignore
else:
TextIO = None # type: ignore
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py
index cfbd5e529f..cebb8f9815 100644
--- a/testsuite/driver/perf_notes.py
+++ b/testsuite/driver/perf_notes.py
@@ -517,7 +517,7 @@ def get_commit_metric(gitNoteRef,
# tolerance_dev: allowed deviation of the actual value from the expected value.
# allowed_perf_changes: allowed changes in stats. This is a dictionary as returned by get_allowed_perf_changes().
# force_print: Print stats even if the test stat was in the tolerance range.
-# Returns a (MetricChange, pass/fail object) tuple. Passes if the stats are withing the expected value ranges.
+# Returns a (MetricChange, pass/fail object) tuple. Passes if the stats are within the expected value ranges.
def check_stats_change(actual: PerfStat,
baseline: Baseline,
tolerance_dev,
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index c39ca7a8c9..2393247b22 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -133,7 +133,7 @@ class TestConfig:
# Do we have SMP support?
self.have_smp = False
- # Is gdb avaliable?
+ # Is gdb available?
self.have_gdb = False
# Is readelf available?
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 79d504a845..07206799c1 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1379,7 +1379,7 @@ def metric_dict(name, way, metric, value) -> PerfStat:
# way: the way.
# stats_file: the path of the stats_file containing the stats for the test.
# range_fields: see TestOptions.stats_range_fields
-# Returns a pass/fail object. Passes if the stats are withing the expected value ranges.
+# Returns a pass/fail object. Passes if the stats are within the expected value ranges.
# This prints the results for the user.
def check_stats(name: TestName,
way: WayName,
diff --git a/testsuite/driver/typing_stubs.py b/testsuite/driver/typing_stubs.py
new file mode 100644
index 0000000000..6f17b5a35c
--- /dev/null
+++ b/testsuite/driver/typing_stubs.py
@@ -0,0 +1,23 @@
+# Stub definitions for things provided by the typing package
+# for use by older Python versions.
+
+import collections
+
+class Dummy:
+ def __getitem__(self, *args):
+ return None
+
+List = Dummy()
+Tuple = Dummy()
+Set = Dummy()
+TextIO = Dummy()
+Iterator = Dummy()
+Callable = Dummy()
+Optional = Dummy()
+Dict = Dummy()
+Union = Dummy()
+Any = Dummy()
+
+NewType = lambda name, ty: ty
+def NamedTuple(name, fields):
+ return collections.namedtuple(name, [field[0] for field in fields])