File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -524,6 +524,7 @@ def __enter__(self):
524
524
sys .meta_path = [ImportFinder (self .watcher , self .orig_meta_path )]
525
525
526
526
sitefix .monkeypatch_quit ()
527
+ sitefix .monkeypatch_reload ()
527
528
return self
528
529
529
530
def __exit__ (self , * args ):
Original file line number Diff line number Diff line change 1
1
import sys
2
+ import functools
2
3
3
4
from six .moves import builtins
4
5
@@ -16,3 +17,26 @@ def __call__(self, code=None):
16
17
def monkeypatch_quit ():
17
18
if 'site' in sys .modules :
18
19
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