"Virtual" file system mock object - replacing stuff in __builtins__
Remy Blank
remy.blank_asps at pobox.com
Tue Mar 9 04:16:00 EST 2004
Lothar Scholz said the following:
> Setup a test directory with data files and in the setUp method copy
> the items from the directory to a temporary directory. Do the tests
> with the temporary directory and remove it in the tearDown method.
That's a solution I rejected quite early, for the following reasons:
- The simplest program I wrote has 64 test cases, and to ensure that
tests are independent, I would have to re-create the test directory
before every test. This is very time-consuming, and doesn't fit well
with the "write test - run - failure - write code - run - success -
refactor - run - success" coding cycle. Currently, the whole test
suite runs in less than a second.
- One program is meant to be used by "root", because it changes file
ownerships and modes. I definitely don't want to run my test suite as
root (if only to avoid wiping my hard disk by error).
> This is the simplest case to avoid strange effects.
What strange effects do you expect (other than due to bugs in the mock
file system, that can be avoided with an extensive test suite)?
-- Remy
Remove underscore and anti-spam suffix in reply address for a timely
response.
More information about the Python-list
mailing list