# \`deepcopy(::Module)\` and mocking for tests

**URL:** <https://discourse.julialang.org/t/deepcopy-module-and-mocking-for-tests/24214>\
**Category:** General Usage\
**Tags:** testing, module\
**Created:** [May 14, 2019, 5:34pm UTC](https://discourse.julialang.org/t/deepcopy-module-and-mocking-for-tests/24214 "2019-05-14T17:34:28Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Per](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/per/32/10387_2.png) [@Per](https://discourse.julialang.org/u/Per)\
**Post date:** [July 18, 2019, 8:02am UTC](https://discourse.julialang.org/t/deepcopy-module-and-mocking-for-tests/24214/4 "2019-07-18T08:02:49Z")

</div>

Great work! This answers [a question](https://discourse.julialang.org/t/eval-a-codeinfo-object/18076) that I’ve been struggling with for a few days now: how to modify a `CodeInfo` object and turn it into a new function. Your code shows exactly how to do this.

Would you mind putting this under an open-source license, so that I can borrow a few lines from your code?

---

_[View the full topic](https://discourse.julialang.org/t/deepcopy-module-and-mocking-for-tests/24214)._
