Html modules do use the `resource_fs` to write files during export (and your changes below make them do that all the time, not just when the html isn't valid xml). However, you can use an inmemory filesystem (https://code.google.com/p/pyfilesystem/, a MemoryFS) to provide a filesystem to unit tests.