[Python-Dev] I need help with IO testuite (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Wed Nov 17 15:58:30 CET 2010


On Thu, Nov 18, 2010 at 12:31 AM, Jesus Cea <jcea at jcea.es> wrote:

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Hi all. I am modifying IO module for Python 3.2, and I am unable to understand the mechanism used in IO testsuite to test both the C and the Python implementation. In particular I need to test that the implementation passes some parameters to the OS. The module uses "Mock" classes, but I think "Mock" is something else, and I don't see how it interpose between the C/Python code and the OS.

The "Mock" refers to stubbing out or substituting various layers of the IO stack with the Python implementations in the test file. It isn't related specifically to the C/Python switching.

If somebody could explain the mechanism a bit...

The actual C/Python switching happens later in the file. It is best to start from the bottom of the file (with the list of test cases that are actually executed) and work your way up from there.

For what Amaury is talking about, what you can test is that the higher layers of the IO stack (e.g. BufferedReader) correctly pass the new flags down to the RawIO layer. You're correct that you can't really test that RawIO is actually passing the flags down to the OS. However, if you have a way to check whether the filesystem in use is ZFS, you may be able to create a conditionally executed test, such that correct behaviour can be verified just by running on a machine that uses ZFS for its temp directory.

Cheers, Nick.

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



More information about the Python-Dev mailing list