[Python-Dev] How to test for stuff like fsync?

Skip Montanaro skip at pobox.com
Fri Sep 26 19:06:49 EDT 2003


When I checked in the HAVE_SYNC -> HAVE_FSYNC change I thought briefly about
including a test to test_os.py.  I eventually decided against it because it
was clear that a simpleminded test for os.fsync's existence was useless.
Jason seems to have been bitten badly by it.  I doubt that fsync() is
available everywhere (otherwise why test for it in the configure script?),
so it seems that Jason should have been testing for its presence (though see
below) and worming around its abscence if he wanted TMDA to run on as many
platforms as possible.

This suggests the following questions:

* Is there a reasonable way to write tests which will detect this sort of
  error?

* Should there be special documentation about os-dependent functions which
  are not universally available?  The fsync() doc says nothing about it not
  always being available (thus Jason can be forgiven for not calling
  hasattr(os, "fsync")).

Skip






More information about the Python-Dev mailing list