[Python-Dev] __sizeof__ tests

Nick Coghlan ncoghlan at gmail.com
Sat Jul 28 15:05:46 CEST 2012

On Sat, Jul 28, 2012 at 6:54 PM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> I have a set of patches about the correct __sizeof__ implementations (one
> has already been committed (issue #15456), 13 left, 2 of them published
> (#15469 for deque and #15475 for itertools)). The most tedious is to write
> tests for them, especially paranoid tests, on which Martin v. Löwis insists.
> For not to duplicate the supporting code, I suggest add (move from test_sys
> test) three utility functions to test.support module (issue #15467). Also
> from the use of the common code will benefit issues #15402 (for struct) and
> #15424 (for array). The testing for cElemetTree also will be easier.
> Martin remarked that this adds new features to test.support and can only be
> done in 3.4. Question to release managers. Whether this is acceptable, if we
> do these functions private (with names that begin with an underscore)? Or
> would we have to copy the supporting code in every test file with __sizeof__
> test?

No, Martin is incorrect on this one. test.support is strictly our turf
and not covered by the normal standard library rules - the only reason
it is documented at all is because *we* want docs for it so people
writing tests don't reinvent too many wheels. Since we reserve the
right to delete stuff without notice, we can certainly add new stuff.

>From the top of the "test" package docs:
The test package is meant for internal use by Python only. It is
documented for the benefit of the core developers of Python. Any use
of this package outside of Python’s standard library is discouraged as
code mentioned here can change or be removed without notice between
releases of Python.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list