[pypy-commit] pypy use-file-star-for-file: allow leakfinder.start_tracking_allocations to be called in test setup
bdkearns
noreply at buildbot.pypy.org
Thu Sep 11 03:33:18 CEST 2014
Author: Brian Kearns <bdkearns at gmail.com>
Branch: use-file-star-for-file
Changeset: r73438:8f2bf775fa49
Date: 2014-09-10 21:31 -0400
http://bitbucket.org/pypy/pypy/changeset/8f2bf775fa49/
Log: allow leakfinder.start_tracking_allocations to be called in test
setup
diff --git a/pypy/module/_file/test/test_file_extra.py b/pypy/module/_file/test/test_file_extra.py
--- a/pypy/module/_file/test/test_file_extra.py
+++ b/pypy/module/_file/test/test_file_extra.py
@@ -1,5 +1,6 @@
import os, random, sys
import rpython.tool.udir
+from rpython.tool import leakfinder
import py
udir = rpython.tool.udir.udir.ensure('test_file_extra', dir=1)
@@ -230,15 +231,16 @@
w_filetype = space.gettypeobject(W_File.typedef)
else:
w_filetype = file # TinyObjSpace, for "py.test -A"
+ self.w_sample = space.wrap(self.sample)
+ self.w_expected_filename = space.wrap(self.expected_filename)
+ self.w_expected_mode = space.wrap(self.expected_mode)
+ self.w_expected_lines = space.wrap(self.get_expected_lines())
+ leakfinder.start_tracking_allocations()
self.w_file = space.call_function(
w_filetype,
space.wrap(self.expected_filename),
space.wrap(self.expected_mode),
*[space.wrap(a) for a in self.extra_args])
- self.w_sample = space.wrap(self.sample)
- self.w_expected_filename = space.wrap(self.expected_filename)
- self.w_expected_mode = space.wrap(self.expected_mode)
- self.w_expected_lines = space.wrap(self.get_expected_lines())
def teardown_method(self, method):
self.space.call_method(self.w_file, 'close')
diff --git a/rpython/conftest.py b/rpython/conftest.py
--- a/rpython/conftest.py
+++ b/rpython/conftest.py
@@ -64,8 +64,9 @@
__multicall__.execute()
if not isinstance(item, py.test.collect.Function):
return
- if not getattr(item.obj, 'dont_track_allocations', False):
- leakfinder.start_tracking_allocations()
+ if (not getattr(item.obj, 'dont_track_allocations', False)
+ and not leakfinder.TRACK_ALLOCATIONS):
+ leakfinder.start_tracking_allocations()
def pytest_runtest_call(self, __multicall__, item):
__multicall__.execute()
More information about the pypy-commit
mailing list