mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-01 16:58:10 +00:00
tests which rely on memory-reclamation need gc.collect() on pypy
This commit is contained in:
parent
8965c77d63
commit
f8117320cb
@ -8,6 +8,7 @@ import six
|
|||||||
import hashlib
|
import hashlib
|
||||||
import os, time, sys
|
import os, time, sys
|
||||||
import yaml
|
import yaml
|
||||||
|
import gc # support PyPy
|
||||||
|
|
||||||
from six.moves import StringIO
|
from six.moves import StringIO
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
@ -1303,9 +1304,11 @@ class CacheDir(unittest.TestCase):
|
|||||||
a = cdm.get_file("a")
|
a = cdm.get_file("a")
|
||||||
b = cdm.get_file("b")
|
b = cdm.get_file("b")
|
||||||
c = cdm.get_file("c")
|
c = cdm.get_file("c")
|
||||||
f = open(a.get_filename(), "wb"); f.write("hi"); f.close(); del f
|
for x in {a, b, c}:
|
||||||
f = open(b.get_filename(), "wb"); f.write("hi"); f.close(); del f
|
with open(x.get_filename(), "wb") as f:
|
||||||
f = open(c.get_filename(), "wb"); f.write("hi"); f.close(); del f
|
f.write("hi")
|
||||||
|
del x
|
||||||
|
gc.collect() # for PyPy
|
||||||
|
|
||||||
_failUnlessExists("a")
|
_failUnlessExists("a")
|
||||||
_failUnlessExists("b")
|
_failUnlessExists("b")
|
||||||
@ -1318,6 +1321,7 @@ class CacheDir(unittest.TestCase):
|
|||||||
_failUnlessExists("c")
|
_failUnlessExists("c")
|
||||||
|
|
||||||
del a
|
del a
|
||||||
|
gc.collect() # for PyPy
|
||||||
# this file won't be deleted yet, because it isn't old enough
|
# this file won't be deleted yet, because it isn't old enough
|
||||||
cdm.check()
|
cdm.check()
|
||||||
_failUnlessExists("a")
|
_failUnlessExists("a")
|
||||||
@ -1335,6 +1339,7 @@ class CacheDir(unittest.TestCase):
|
|||||||
cdm.old = 60*60
|
cdm.old = 60*60
|
||||||
|
|
||||||
del b
|
del b
|
||||||
|
gc.collect() # for PyPy
|
||||||
|
|
||||||
cdm.check()
|
cdm.check()
|
||||||
_failIfExists("a")
|
_failIfExists("a")
|
||||||
@ -1348,6 +1353,7 @@ class CacheDir(unittest.TestCase):
|
|||||||
_failUnlessExists("b")
|
_failUnlessExists("b")
|
||||||
_failUnlessExists("c")
|
_failUnlessExists("c")
|
||||||
del b2
|
del b2
|
||||||
|
gc.collect() # for PyPy
|
||||||
|
|
||||||
ctr = [0]
|
ctr = [0]
|
||||||
class EqButNotIs(object):
|
class EqButNotIs(object):
|
||||||
@ -1617,6 +1623,7 @@ class Pipeline(unittest.TestCase):
|
|||||||
self.calls[2][0].errback(ValueError("three-error"))
|
self.calls[2][0].errback(ValueError("three-error"))
|
||||||
|
|
||||||
del d1,d2,d3,d4
|
del d1,d2,d3,d4
|
||||||
|
gc.collect() # for PyPy
|
||||||
|
|
||||||
class SampleError(Exception):
|
class SampleError(Exception):
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user