Skip to content
jafd edited this page Jan 2, 2012 · 1 revision

This page will outline the tests that every txfileio implementation must pass to be valid. Passing the unit tests in a library like this is necessary but is not sufficient; a great deal of integration tests must be done, in real environment, to catch all the bugs. There is a reason behind not unit-testing the Linux kernel, besides it being too bloated: the real world is amazingly unpredictable, hardware is flaky in every possible way you can think of and then some.

  • calling IManager.open() must return a Deferred
  • the Deferred must return an IProxy wrapping a real file-like object if a blocking call would return a file-like object
  • the Deferred must fail with exactly the same failure if a blocking call would
  • calling IManager.take(fileobject) must return that object wrapped into IProxy
  • in returned IProxies, manager reference must point to exactly this instance of IManager
  • it is possible to create multiple IManager instances and they work flawlessly unaware of each other
  • all callables to the file-like object return a Deferred and results are the same as if they would be when called in blocking fashion
  • a function with blocking calls passed to runInteraction behaves exactly the same way as it would be if run in a regular Python code in main thread, except that the result is a Deferred

An integration test most probably would contain some server and client (echo would suffice) which also do large file copying in the background that would otherwise measurably block. Maybe a mockish proxy object would be introduced that sleeps at random intervals on each method.

Clone this wiki locally