Simplify and rearrange wrapping mechanism to call functools.wraps() at import time instead of method-call time
Fix occasional MotorDatabaseTest failure