diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2620162..898dfe5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,6 @@ jobs: env: COLUMNS: 120 run: | - pytest --color=yes -ra -v --cov --cov-report=xml + pytest --color=yes -raXxs --cov --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index a911c3e..b48b572 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -161,13 +161,6 @@ def no_op(*a, **kw): class SpaceInInput(Exception): pass -def get_default_colors(): - "DEPRECATED" - warn('get_default_color is deprecated since IPython 5.0, and returns `Neutral` on all platforms.', - DeprecationWarning, stacklevel=2) - return 'Neutral' - - class SeparateUnicode(Unicode): r"""A Unicode subclass to validate separate_in, separate_out, etc. @@ -440,29 +433,6 @@ class InteractiveShell(SingletonConfigurable): will be displayed as regular output instead.""" ).tag(config=True) - # deprecated prompt traits: - - prompt_in1 = Unicode('In [\\#]: ', - help="Deprecated since IPython 4.0 and ignored since 5.0, set TerminalInteractiveShell.prompts object directly." - ).tag(config=True) - prompt_in2 = Unicode(' .\\D.: ', - help="Deprecated since IPython 4.0 and ignored since 5.0, set TerminalInteractiveShell.prompts object directly." - ).tag(config=True) - prompt_out = Unicode('Out[\\#]: ', - help="Deprecated since IPython 4.0 and ignored since 5.0, set TerminalInteractiveShell.prompts object directly." - ).tag(config=True) - prompts_pad_left = Bool(True, - help="Deprecated since IPython 4.0 and ignored since 5.0, set TerminalInteractiveShell.prompts object directly." - ).tag(config=True) - - @observe('prompt_in1', 'prompt_in2', 'prompt_out', 'prompt_pad_left') - def _prompt_trait_changed(self, change): - name = change['name'] - warn("InteractiveShell.{name} is deprecated since IPython 4.0" - " and ignored since 5.0, set TerminalInteractiveShell.prompts" - " object directly.".format(name=name)) - - # protect against weird cases where self.config may not exist: show_rewritten_input = Bool(True, help="Show rewritten input, e.g. for autocall." @@ -2038,19 +2008,6 @@ class InteractiveShell(SingletonConfigurable): the %paste magic.""" self.showsyntaxerror() - #------------------------------------------------------------------------- - # Things related to readline - #------------------------------------------------------------------------- - - def init_readline(self): - """DEPRECATED - - Moved to terminal subclass, here only to simplify the init logic.""" - # Set a number of methods that depend on readline to be no-op - warnings.warn('`init_readline` is no-op since IPython 5.0 and is Deprecated', - DeprecationWarning, stacklevel=2) - self.set_custom_completer = no_op - @skip_doctest def set_next_input(self, s, replace=False): """ Sets the 'default' input string for the next command line. @@ -3513,20 +3470,6 @@ class InteractiveShell(SingletonConfigurable): file_path.write_text(data) return filename - @undoc - def write(self,data): - """DEPRECATED: Write a string to the default output""" - warn('InteractiveShell.write() is deprecated, use sys.stdout instead', - DeprecationWarning, stacklevel=2) - sys.stdout.write(data) - - @undoc - def write_err(self,data): - """DEPRECATED: Write a string to the default error output""" - warn('InteractiveShell.write_err() is deprecated, use sys.stderr instead', - DeprecationWarning, stacklevel=2) - sys.stderr.write(data) - def ask_yes_no(self, prompt, default=None, interrupt=None): if self.quiet: return True diff --git a/IPython/core/tests/test_magic_terminal.py b/IPython/core/tests/test_magic_terminal.py index d798428..721fd5e 100644 --- a/IPython/core/tests/test_magic_terminal.py +++ b/IPython/core/tests/test_magic_terminal.py @@ -149,8 +149,8 @@ class PasteTestCase(TestCase): def test_paste_echo(self): "Also test self.paste echoing, by temporarily faking the writer" w = StringIO() - writer = ip.write - ip.write = w.write + old_write = sys.stdout.write + sys.stdout.write = w.write code = """ a = 100 b = 200""" @@ -158,7 +158,7 @@ class PasteTestCase(TestCase): self.paste(code,'') out = w.getvalue() finally: - ip.write = writer + sys.stdout.write = old_write self.assertEqual(ip.user_ns["a"], 100) self.assertEqual(ip.user_ns["b"], 200) assert out == code + "\n## -- End pasted text --\n" diff --git a/IPython/terminal/magics.py b/IPython/terminal/magics.py index 3884223..aef9607 100644 --- a/IPython/terminal/magics.py +++ b/IPython/terminal/magics.py @@ -198,11 +198,10 @@ class TerminalMagics(Magics): # By default, echo back to terminal unless quiet mode is requested if 'q' not in opts: - write = self.shell.write - write(self.shell.pycolorize(block)) - if not block.endswith('\n'): - write('\n') - write("## -- End pasted text --\n") + sys.stdout.write(self.shell.pycolorize(block)) + if not block.endswith("\n"): + sys.stdout.write("\n") + sys.stdout.write("## -- End pasted text --\n") self.store_or_execute(block, name) diff --git a/IPython/utils/io.py b/IPython/utils/io.py index 1600fc3..638471e 100644 --- a/IPython/utils/io.py +++ b/IPython/utils/io.py @@ -233,11 +233,6 @@ def raw_print_err(*args, **kw): file=sys.__stderr__) sys.__stderr__.flush() -# used by IPykernel <- 4.9. Removed during IPython 7-dev period and re-added -# Keep for a version or two then should remove -rprint = raw_print -rprinte = raw_print_err - @undoc def unicode_std_stream(stream='stdout'): """DEPRECATED, moved to nbconvert.utils.io"""