summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-12 01:20:39 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-12 01:20:39 (GMT)
commitb5b7b78414e5f1a42ab4205c110626c9cd7a79b9 (patch)
tree53921f05d2230d38c742bd3d02263e30d172322a /Lib/test/regrtest.py
parent28ccc2463ef9ae30560a7bbbc683291757edb9aa (diff)
downloadcpython-b5b7b78414e5f1a42ab4205c110626c9cd7a79b9.zip
cpython-b5b7b78414e5f1a42ab4205c110626c9cd7a79b9.tar.gz
cpython-b5b7b78414e5f1a42ab4205c110626c9cd7a79b9.tar.bz2
Teach regrtest which tests we *expect* to skip on Win32. Please teach it
about your platform too.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 4588036..b6d09c8 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -169,6 +169,20 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
print count(len(skipped), "test"), "skipped:",
print " ".join(skipped)
+ e = _ExpectedSkips()
+ if e.isvalid():
+ surprise = _Set(skipped) - e.getexpected()
+ plat = sys.platform
+ if surprise:
+ print count(len(surprise), "skip"), \
+ "unexpected on", plat + ":", \
+ " ".join(surprise.tolist())
+ else:
+ print "Those skips are all expected on", plat + "."
+ else:
+ print "Ask someone to teach regrtest.py about which tests are"
+ print "expected to get skipped on", plat + "."
+
if single:
alltests = findtests(testdir, stdtests, nottests)
for i in range(len(alltests)):
@@ -360,5 +374,76 @@ class Compare:
def isatty(self):
return 0
+class _Set:
+ def __init__(self, seq=[]):
+ data = self.data = {}
+ for x in seq:
+ data[x] = 1
+
+ def __len__(self):
+ return len(self.data)
+
+ def __sub__(self, other):
+ "Return set of all elements in self not in other."
+ result = _Set()
+ data = result.data = self.data.copy()
+ for x in other.data:
+ if x in data:
+ del data[x]
+ return result
+
+ def tolist(self, sorted=1):
+ "Return _Set elements as a list."
+ data = self.data.keys()
+ if sorted:
+ data.sort()
+ return data
+
+class _ExpectedSkips:
+ def __init__(self):
+ self.valid = 0
+
+ if sys.platform == "win32":
+ self.valid = 1
+ s = """test_al
+ test_cd
+ test_cl
+ test_commands
+ test_crypt
+ test_dbm
+ test_dl
+ test_fcntl
+ test_fork1
+ test_gdbm
+ test_gl
+ test_grp
+ test_imgfile
+ test_largefile
+ test_linuxaudiodev
+ test_mhlib
+ test_nis
+ test_openpty
+ test_poll
+ test_pty
+ test_pwd
+ test_signal
+ test_socketserver
+ test_sunaudiodev
+ test_timing"""
+ self.expected = _Set(s.split())
+
+ def isvalid(self):
+ "Return true iff _ExpectedSkips knows about the current platform."
+ return self.valid
+
+ def getexpected(self):
+ """Return set of test names we expect to skip on current platform.
+
+ self.isvalid() must be true.
+ """
+
+ assert self.isvalid()
+ return self.expected
+
if __name__ == '__main__':
sys.exit(main())