[py-dev] Advanced monkeypatching?

Virgil Dupras hsoft at hardcoded.net
Sat Dec 18 15:51:26 CET 2010


Hi there,

Monkeypatching is great and all, but some type of patching is a little bit more complex to do, such as patching the system time and patching os.stat for specific filenames. I have my own "homebrewed" solution for this, but I was wondering if such solution had their place in the monkeypatch module of pytest itself. Does it? Or should a "pytest-monkeypatch++" package be created?

The "homebrewed" code I'm talking about is at https://bitbucket.org/hsoft/hsutil/src/43014954c6a8/hsutil/testutil.py#cl-83 ( patch_osstat() and patch_today() ).
--
Virgil Dupras




More information about the Pytest-dev mailing list