Option to use python file operations when saving xml
Bug #1989343 reported by
buhtz
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Triaged
|
Low
|
Unassigned |
Bug Description
Lxml doesn't use python in-build features to write/save xml files. You use your own C part for it. That makes Lxml much faster and attractive. I understand that and won't change it.
But in some circumstances (e.g. unittesting with fake/virtual filesystems like pyfakefs) this breaks a lot of things.
It would be nice if there could be an option to say lxml to use regular python Technics when writing files.
To post a comment you must log in.
Thanks for the report.
lxml actually does make use of the Python operations for files that you pass it as open file objects (as opposed to file paths). Does that help?
Maybe you could use mock to replace lxml's file writing functions with a wrapper that opens the file from a path before passing it on?