Commit 865898f5 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Remove a bunch of changes we made to cpython's testsuite

parent dacfd456
...@@ -223,8 +223,7 @@ class TestABC(unittest.TestCase): ...@@ -223,8 +223,7 @@ class TestABC(unittest.TestCase):
C().f() C().f()
del C del C
test_support.gc_collect() test_support.gc_collect()
# Pyston change: disable it for now. self.assertEqual(r(), None)
# self.assertEqual(r(), None)
def test_main(): def test_main():
test_support.run_unittest(TestABC) test_support.run_unittest(TestABC)
......
...@@ -765,8 +765,6 @@ class BaseTest(unittest.TestCase): ...@@ -765,8 +765,6 @@ class BaseTest(unittest.TestCase):
b = buffer(a) b = buffer(a)
self.assertEqual(b[0], a.tostring()[0]) self.assertEqual(b[0], a.tostring()[0])
# Pyston change: disable this test because of our GC
@unittest.skip("Pyston" in sys.version)
def test_weakref(self): def test_weakref(self):
s = array.array(self.typecode, self.example) s = array.array(self.typecode, self.example)
p = proxy(s) p = proxy(s)
......
...@@ -433,15 +433,12 @@ class ComplexTest(unittest.TestCase): ...@@ -433,15 +433,12 @@ class ComplexTest(unittest.TestCase):
test_values = (1, 123.0, 10-19j, xcomplex(1+2j), test_values = (1, 123.0, 10-19j, xcomplex(1+2j),
xcomplex(1+87j), xcomplex(10+90j)) xcomplex(1+87j), xcomplex(10+90j))
# Pyston change: if rhs is a subclass of lhs, then should try
# reverse the order. Pyston don't support it yet. Need to improve
# binop handing.
for op in infix_binops: for op in infix_binops:
for x in xcomplex_values: for x in xcomplex_values:
for y in test_values: for y in test_values:
a = 'x %s y' % op a = 'x %s y' % op
b = 'y %s x' % op b = 'y %s x' % op
# self.assertTrue(type(eval(a)) is type(eval(b)) is xcomplex) self.assertTrue(type(eval(a)) is type(eval(b)) is xcomplex)
def test_hash(self): def test_hash(self):
for x in xrange(-30, 30): for x in xrange(-30, 30):
......
...@@ -29,8 +29,6 @@ class AutoFileTests(unittest.TestCase): ...@@ -29,8 +29,6 @@ class AutoFileTests(unittest.TestCase):
self.f.close() self.f.close()
os.remove(TESTFN) os.remove(TESTFN)
# Pyston change: disabled
@unittest.skip("this depends on refcounting")
def testWeakRefs(self): def testWeakRefs(self):
# verify weak references # verify weak references
p = proxy(self.f) p = proxy(self.f)
......
...@@ -28,8 +28,6 @@ class AutoFileTests(unittest.TestCase): ...@@ -28,8 +28,6 @@ class AutoFileTests(unittest.TestCase):
self.f.close() self.f.close()
os.remove(TESTFN) os.remove(TESTFN)
# Pyston change: disable this test becasue of GC
@unittest.skip("only works with refcounting")
def testWeakRefs(self): def testWeakRefs(self):
# verify weak references # verify weak references
p = proxy(self.f) p = proxy(self.f)
......
...@@ -119,10 +119,7 @@ class MmapTests(unittest.TestCase): ...@@ -119,10 +119,7 @@ class MmapTests(unittest.TestCase):
def test_access_parameter(self): def test_access_parameter(self):
# Test for "access" keyword parameter # Test for "access" keyword parameter
mapsize = 10 mapsize = 10
# Pyston change: use a with statement to not rely on the destructor being called: open(TESTFN, "wb").write("a"*mapsize)
# open(TESTFN, "wb").write("a"*mapsize)
with open(TESTFN, "wb") as f:
f.write("a"*mapsize)
f = open(TESTFN, "rb") f = open(TESTFN, "rb")
m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_READ) m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_READ)
self.assertEqual(m[:], 'a'*mapsize, "Readonly memory map data incorrect.") self.assertEqual(m[:], 'a'*mapsize, "Readonly memory map data incorrect.")
...@@ -541,10 +538,7 @@ class MmapTests(unittest.TestCase): ...@@ -541,10 +538,7 @@ class MmapTests(unittest.TestCase):
@unittest.skipUnless(hasattr(mmap, 'PROT_READ'), "needs mmap.PROT_READ") @unittest.skipUnless(hasattr(mmap, 'PROT_READ'), "needs mmap.PROT_READ")
def test_prot_readonly(self): def test_prot_readonly(self):
mapsize = 10 mapsize = 10
# Pyston change: use a with statement to not rely on the destructor being called: open(TESTFN, "wb").write("a"*mapsize)
# open(TESTFN, "wb").write("a"*mapsize)
with open(TESTFN, "wb") as f:
f.write("a"*mapsize)
f = open(TESTFN, "rb") f = open(TESTFN, "rb")
m = mmap.mmap(f.fileno(), mapsize, prot=mmap.PROT_READ) m = mmap.mmap(f.fileno(), mapsize, prot=mmap.PROT_READ)
self.assertRaises(TypeError, m.write, "foo") self.assertRaises(TypeError, m.write, "foo")
...@@ -556,10 +550,7 @@ class MmapTests(unittest.TestCase): ...@@ -556,10 +550,7 @@ class MmapTests(unittest.TestCase):
def test_io_methods(self): def test_io_methods(self):
data = "0123456789" data = "0123456789"
# Pyston change: use a with statement to not rely on the destructor being called: open(TESTFN, "wb").write("x"*len(data))
# open(TESTFN, "wb").write("x"*len(data))
with open(TESTFN, "wb") as f:
f.write("x"*len(data))
f = open(TESTFN, "r+b") f = open(TESTFN, "r+b")
m = mmap.mmap(f.fileno(), len(data)) m = mmap.mmap(f.fileno(), len(data))
f.close() f.close()
...@@ -626,10 +617,7 @@ class MmapTests(unittest.TestCase): ...@@ -626,10 +617,7 @@ class MmapTests(unittest.TestCase):
m.close() m.close()
# Should not crash (Issue 5385) # Should not crash (Issue 5385)
# Pyston change: use a with statement to not rely on the destructor being called: open(TESTFN, "wb").write("x"*10)
# open(TESTFN, "wb").write("x"*10)
with open(TESTFN, "wb") as f:
f.write("x"*10)
f = open(TESTFN, "r+b") f = open(TESTFN, "r+b")
m = mmap.mmap(f.fileno(), 0) m = mmap.mmap(f.fileno(), 0)
f.close() f.close()
......
...@@ -337,9 +337,7 @@ class TestJointOps(unittest.TestCase): ...@@ -337,9 +337,7 @@ class TestJointOps(unittest.TestCase):
obj.x = iter(container) obj.x = iter(container)
del obj, container del obj, container
gc.collect() gc.collect()
# Pyston change: because with conservative scanning self.assertTrue(ref() is None, "Cycle was not collected")
# it is hard to guarantee finalizer calls
# self.assertTrue(ref() is None, "Cycle was not collected")
class TestSet(TestJointOps): class TestSet(TestJointOps):
thetype = set thetype = set
...@@ -560,9 +558,7 @@ class TestSet(TestJointOps): ...@@ -560,9 +558,7 @@ class TestSet(TestJointOps):
p = weakref.proxy(s) p = weakref.proxy(s)
self.assertEqual(str(p), str(s)) self.assertEqual(str(p), str(s))
s = None s = None
# Pyston change: because with conservative scanning self.assertRaises(ReferenceError, str, p)
# it is hard to guarantee finalizer calls
# self.assertRaises(ReferenceError, str, p)
@unittest.skipUnless(hasattr(set, "test_c_api"), @unittest.skipUnless(hasattr(set, "test_c_api"),
'C API test only available in a debug build') 'C API test only available in a debug build')
......
...@@ -79,8 +79,7 @@ class InterProcessSignalTests(unittest.TestCase): ...@@ -79,8 +79,7 @@ class InterProcessSignalTests(unittest.TestCase):
# don't worry about re-setting the default handlers. # don't worry about re-setting the default handlers.
signal.signal(signal.SIGHUP, self.handlerA) signal.signal(signal.SIGHUP, self.handlerA)
signal.signal(signal.SIGUSR1, self.handlerB) signal.signal(signal.SIGUSR1, self.handlerB)
# Pyston change: pyston uses SIGUSR2 internally signal.signal(signal.SIGUSR2, signal.SIG_IGN)
# signal.signal(signal.SIGUSR2, signal.SIG_IGN)
signal.signal(signal.SIGALRM, signal.default_int_handler) signal.signal(signal.SIGALRM, signal.default_int_handler)
# Variables the signals will modify: # Variables the signals will modify:
...@@ -118,10 +117,9 @@ class InterProcessSignalTests(unittest.TestCase): ...@@ -118,10 +117,9 @@ class InterProcessSignalTests(unittest.TestCase):
print "HandlerBCalled exception caught" print "HandlerBCalled exception caught"
# Pyston change: pyston uses SIGUSR2 internally child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)])
# child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)]) if child:
# if child: self.wait(child) # Nothing should happen.
# self.wait(child) # Nothing should happen.
try: try:
signal.alarm(1) signal.alarm(1)
......
...@@ -1359,10 +1359,6 @@ extern "C" PyOS_sighandler_t PyOS_getsig(int sig) noexcept { ...@@ -1359,10 +1359,6 @@ extern "C" PyOS_sighandler_t PyOS_getsig(int sig) noexcept {
} }
extern "C" PyOS_sighandler_t PyOS_setsig(int sig, PyOS_sighandler_t handler) noexcept { extern "C" PyOS_sighandler_t PyOS_setsig(int sig, PyOS_sighandler_t handler) noexcept {
if (sig == SIGUSR2) {
Py_FatalError("SIGUSR2 is reserved for Pyston internal use");
}
#ifdef HAVE_SIGACTION #ifdef HAVE_SIGACTION
/* Some code in Modules/signalmodule.c depends on sigaction() being /* Some code in Modules/signalmodule.c depends on sigaction() being
* used here if HAVE_SIGACTION is defined. Fix that if this code * used here if HAVE_SIGACTION is defined. Fix that if this code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment