By replacing the entry in sys.modules. pytest does this.
Attach a file by drag & drop or click to upload