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):
C().f()
del C
test_support.gc_collect()
# Pyston change: disable it for now.
# self.assertEqual(r(), None)
self.assertEqual(r(), None)
def test_main():
test_support.run_unittest(TestABC)
......
......@@ -765,8 +765,6 @@ class BaseTest(unittest.TestCase):
b = buffer(a)
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):
s = array.array(self.typecode, self.example)
p = proxy(s)
......
......@@ -433,15 +433,12 @@ class ComplexTest(unittest.TestCase):
test_values = (1, 123.0, 10-19j, xcomplex(1+2j),
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 x in xcomplex_values:
for y in test_values:
a = 'x %s y' % 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):
for x in xrange(-30, 30):
......
......@@ -29,8 +29,6 @@ class AutoFileTests(unittest.TestCase):
self.f.close()
os.remove(TESTFN)
# Pyston change: disabled
@unittest.skip("this depends on refcounting")
def testWeakRefs(self):
# verify weak references
p = proxy(self.f)
......
......@@ -28,8 +28,6 @@ class AutoFileTests(unittest.TestCase):
self.f.close()
os.remove(TESTFN)
# Pyston change: disable this test becasue of GC
@unittest.skip("only works with refcounting")
def testWeakRefs(self):
# verify weak references
p = proxy(self.f)
......
......@@ -119,10 +119,7 @@ class MmapTests(unittest.TestCase):
def test_access_parameter(self):
# Test for "access" keyword parameter
mapsize = 10
# Pyston change: use a with statement to not rely on the destructor being called:
# open(TESTFN, "wb").write("a"*mapsize)
with open(TESTFN, "wb") as f:
f.write("a"*mapsize)
open(TESTFN, "wb").write("a"*mapsize)
f = open(TESTFN, "rb")
m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_READ)
self.assertEqual(m[:], 'a'*mapsize, "Readonly memory map data incorrect.")
......@@ -541,10 +538,7 @@ class MmapTests(unittest.TestCase):
@unittest.skipUnless(hasattr(mmap, 'PROT_READ'), "needs mmap.PROT_READ")
def test_prot_readonly(self):
mapsize = 10
# Pyston change: use a with statement to not rely on the destructor being called:
# open(TESTFN, "wb").write("a"*mapsize)
with open(TESTFN, "wb") as f:
f.write("a"*mapsize)
open(TESTFN, "wb").write("a"*mapsize)
f = open(TESTFN, "rb")
m = mmap.mmap(f.fileno(), mapsize, prot=mmap.PROT_READ)
self.assertRaises(TypeError, m.write, "foo")
......@@ -556,10 +550,7 @@ class MmapTests(unittest.TestCase):
def test_io_methods(self):
data = "0123456789"
# Pyston change: use a with statement to not rely on the destructor being called:
# open(TESTFN, "wb").write("x"*len(data))
with open(TESTFN, "wb") as f:
f.write("x"*len(data))
open(TESTFN, "wb").write("x"*len(data))
f = open(TESTFN, "r+b")
m = mmap.mmap(f.fileno(), len(data))
f.close()
......@@ -626,10 +617,7 @@ class MmapTests(unittest.TestCase):
m.close()
# 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)
with open(TESTFN, "wb") as f:
f.write("x"*10)
open(TESTFN, "wb").write("x"*10)
f = open(TESTFN, "r+b")
m = mmap.mmap(f.fileno(), 0)
f.close()
......
......@@ -337,9 +337,7 @@ class TestJointOps(unittest.TestCase):
obj.x = iter(container)
del obj, container
gc.collect()
# Pyston change: because with conservative scanning
# it is hard to guarantee finalizer calls
# self.assertTrue(ref() is None, "Cycle was not collected")
self.assertTrue(ref() is None, "Cycle was not collected")
class TestSet(TestJointOps):
thetype = set
......@@ -560,9 +558,7 @@ class TestSet(TestJointOps):
p = weakref.proxy(s)
self.assertEqual(str(p), str(s))
s = None
# Pyston change: because with conservative scanning
# it is hard to guarantee finalizer calls
# self.assertRaises(ReferenceError, str, p)
self.assertRaises(ReferenceError, str, p)
@unittest.skipUnless(hasattr(set, "test_c_api"),
'C API test only available in a debug build')
......
......@@ -79,8 +79,7 @@ class InterProcessSignalTests(unittest.TestCase):
# don't worry about re-setting the default handlers.
signal.signal(signal.SIGHUP, self.handlerA)
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)
# Variables the signals will modify:
......@@ -118,10 +117,9 @@ class InterProcessSignalTests(unittest.TestCase):
print "HandlerBCalled exception caught"
# Pyston change: pyston uses SIGUSR2 internally
# child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)])
# if child:
# self.wait(child) # Nothing should happen.
child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)])
if child:
self.wait(child) # Nothing should happen.
try:
signal.alarm(1)
......
......@@ -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 {
if (sig == SIGUSR2) {
Py_FatalError("SIGUSR2 is reserved for Pyston internal use");
}
#ifdef HAVE_SIGACTION
/* Some code in Modules/signalmodule.c depends on sigaction() being
* 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