File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -524,6 +524,7 @@ def __enter__(self):
524524 sys .meta_path = [ImportFinder (self .watcher , self .orig_meta_path )]
525525
526526 sitefix .monkeypatch_quit ()
527+ sitefix .monkeypatch_reload ()
527528 return self
528529
529530 def __exit__ (self , * args ):
Original file line number Diff line number Diff line change 11import sys
2+ import functools
23
34from six .moves import builtins
45
@@ -16,3 +17,26 @@ def __call__(self, code=None):
1617def monkeypatch_quit ():
1718 if 'site' in sys .modules :
1819 resetquit (builtins )
20+
21+
22+ orig_reload = builtins .reload
23+
24+
25+ def reload (module ):
26+ if module is sys :
27+ orig_stdout = sys .stdout
28+ orig_stderr = sys .stderr
29+ orig_stdin = sys .stdin
30+ orig_reload (sys )
31+ sys .stdout = orig_stdout
32+ sys .stderr = orig_stderr
33+ sys .stdin = orig_stdin
34+ else :
35+ builtins .reload (sys )
36+
37+
38+ functools .update_wrapper (reload , orig_reload )
39+
40+
41+ def monkeypatch_reload ():
42+ builtins .reload = reload
You can’t perform that action at this time.
0 commit comments