Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fixing duplicated definition of magic aliases after reset #11806
It was morre incase there was spyder specific issues here so that you could properly tag them; and more giving more rights that requesting more from you.
Thanks, I'll try to lay out what I believe we should try to do.
Ok, so I looked into it a bit more carefully and it is slightly more complicated to write test, so here is what I came up with:
modified: IPython/core/tests/test_magic.py @ test_magic.py:374 @ def test_reset_in_length(): _ip.run_cell("reset -f in") nt.assert_equal(len(_ip.user_ns['In']), _ip.displayhook.prompt_count+1) +class TestResertFErrors(TestCase): + def test_reset_redefine(self): + @magics_class + class KernelMagics(Magics): + @line_magic + def less(self, shell): pass + _ip.register_magics(KernelMagics) + with self.assertLogs() as cm: + # hack, we want to just capture logs, but assertLogs fails if not + # logs get produce. + # so log one things we ignore. + import logging as log_mod + log = log_mod.getLogger() + log.info('Nothing') + # end hack. + _ip.run_cell("reset -f") + assert len(cm.output) == 1 + for out in cm.output: + assert "Invalid alias" not in out def test_tb_syntaxerror(): """test %tb after a SyntaxError""" ip = get_ipython()
You can use it as-is, or try to come up with a better way, but it's tricky enough that I can't request you to write an annoying test case like that.
If you just want to change your code from
@juanis2112 You've done some great contribution, as I wan to release 7.7. soon; I've pushed the test on your branch; and also switched from Try-except to
Thanks Again and looking forward to your next contribution.
Jul 23, 2019
In that case I accept your offer. I didn't know about the new Github functionality you mentioned above, and I think it'd be really useful in this case.
No problem, the hard part of the work was down, and it was only annoying details to finish.
I'm not sure the feature is available on all orgs yet, hence why you might not have seen it.Ok, I'll invite you to the right team for that; let me know if you know any body else that would like to be added to triage.