Show More
@@ -3,6 +3,8 b'' | |||||
3 | Color schemes for exception handling code in IPython. |
|
3 | Color schemes for exception handling code in IPython. | |
4 | """ |
|
4 | """ | |
5 |
|
5 | |||
|
6 | import warnings | |||
|
7 | ||||
6 | #***************************************************************************** |
|
8 | #***************************************************************************** | |
7 | # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu> |
|
9 | # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu> | |
8 | # |
|
10 | # | |
@@ -127,9 +129,19 b' def exception_colors():' | |||||
127 |
|
129 | |||
128 | return ex_colors |
|
130 | return ex_colors | |
129 |
|
131 | |||
|
132 | class Deprec(object): | |||
|
133 | ||||
|
134 | def __init__(self, wrapped_obj): | |||
|
135 | self.wrapped=wrapped_obj | |||
|
136 | ||||
|
137 | def __getattr__(self, name): | |||
|
138 | val = getattr(self.wrapped, name) | |||
|
139 | warnings.warn("Using ExceptionColors global is deprecated", DeprecationWarning) | |||
|
140 | # using getattr after warnings break ipydoctest in weird way for 3.5 | |||
|
141 | return val | |||
130 |
|
142 | |||
131 | # For backwards compatibility, keep around a single global object. Note that |
|
143 | # For backwards compatibility, keep around a single global object. Note that | |
132 | # this should NOT be used, the factory function should be used instead, since |
|
144 | # this should NOT be used, the factory function should be used instead, since | |
133 | # these objects are stateful and it's very easy to get strange bugs if any code |
|
145 | # these objects are stateful and it's very easy to get strange bugs if any code | |
134 | # modifies the module-level object's state. |
|
146 | # modifies the module-level object's state. | |
135 | ExceptionColors = exception_colors() |
|
147 | ExceptionColors = Deprec(exception_colors()) |
@@ -128,11 +128,11 b' class DocTestFinder(doctest.DocTestFinder):' | |||||
128 | Find tests for the given object and any contained objects, and |
|
128 | Find tests for the given object and any contained objects, and | |
129 | add them to `tests`. |
|
129 | add them to `tests`. | |
130 | """ |
|
130 | """ | |
131 |
|
|
131 | print('_find for:', obj, name, module) # dbg | |
132 | if hasattr(obj,"skip_doctest"): |
|
132 | if hasattr(obj,"skip_doctest"): | |
133 | #print 'SKIPPING DOCTEST FOR:',obj # dbg |
|
133 | #print 'SKIPPING DOCTEST FOR:',obj # dbg | |
134 | obj = DocTestSkip(obj) |
|
134 | obj = DocTestSkip(obj) | |
135 |
|
135 | |||
136 | doctest.DocTestFinder._find(self,tests, obj, name, module, |
|
136 | doctest.DocTestFinder._find(self,tests, obj, name, module, | |
137 | source_lines, globs, seen) |
|
137 | source_lines, globs, seen) | |
138 |
|
138 |
General Comments 0
You need to be logged in to leave comments.
Login now