[Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?
Ben Finney
ben+python at benfinney.id.au
Fri Jan 29 17:15:18 EST 2016
Alan Gauld <alan.gauld at btinternet.com> writes:
> File simulation is faster and fine for unit testing functionality,
> but not so good for testing the overall system.
Yes, I'm only advocating fake files for unit tests which, more than all
other kinds of tests, need to be fast and numerous.
For testing larger parts of the system than a single code unit, real
files are better. But likewise, there should be fewer tests (because
complete-coverage unit tests should be much more numerous) so the slower
performance is not so much a problem.
--
\ “I got fired from my job the other day. They said my |
`\ personality was weird. … That's okay, I have four more.” |
_o__) —Bug-Eyed Earl, _Red Meat_ |
Ben Finney
More information about the Tutor
mailing list