[pypy-commit] pypy py3k: merge default
bdkearns
noreply at buildbot.pypy.org
Tue Mar 5 06:31:51 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch: py3k
Changeset: r62056:668230184059
Date: 2013-03-05 00:31 -0500
http://bitbucket.org/pypy/pypy/changeset/668230184059/
Log: merge default
diff --git a/pypy/module/test_lib_pypy/test_sqlite3.py b/pypy/module/test_lib_pypy/test_sqlite3.py
--- a/pypy/module/test_lib_pypy/test_sqlite3.py
+++ b/pypy/module/test_lib_pypy/test_sqlite3.py
@@ -68,15 +68,24 @@
def test_connection_del(tmpdir):
"""For issue1325."""
import gc
+ try:
+ import resource
+ except ImportError:
+ pytest.skip("needs resource module")
- def open_many(cleanup):
- con = []
- for i in range(1024):
- con.append(_sqlite3.connect(str(tmpdir.join('test.db'))))
- if cleanup:
- con[i] = None
- gc.collect(); gc.collect()
+ limit = resource.getrlimit(resource.RLIMIT_NOFILE)
+ try:
+ resource.setrlimit(resource.RLIMIT_NOFILE, (min(10, limit[0]), limit[1]))
+ def open_many(cleanup):
+ con = []
+ for i in range(20):
+ con.append(_sqlite3.connect(str(tmpdir.join('test.db'))))
+ if cleanup:
+ con[i] = None
+ gc.collect(); gc.collect()
- pytest.raises(_sqlite3.OperationalError, open_many, False)
- gc.collect(); gc.collect()
- open_many(True)
+ pytest.raises(_sqlite3.OperationalError, open_many, False)
+ gc.collect(); gc.collect()
+ open_many(True)
+ finally:
+ resource.setrlimit(resource.RLIMIT_NOFILE, limit)
More information about the pypy-commit
mailing list