##// END OF EJS Templates
more fixes
M Bussonnier -
Show More
@@ -38,9 +38,11 from IPython.utils.syspathcontext import prepended_to_syspath
38 # import needed by doctest
38 # import needed by doctest
39 from .test_debugger import PdbTestInput # noqa: F401
39 from .test_debugger import PdbTestInput # noqa: F401
40
40
41 _ip = get_ipython()
41
42
42 @magic.magics_class
43 @magic.magics_class
43 class DummyMagics(magic.Magics): pass
44 class DummyMagics(magic.Magics):
45 pass
44
46
45 def test_extract_code_ranges():
47 def test_extract_code_ranges():
46 instr = "1 3 5-6 7-9 10:15 17: :10 10- -13 :"
48 instr = "1 3 5-6 7-9 10:15 17: :10 10- -13 :"
@@ -476,13 +478,13 def test_time_no_output_with_semicolon():
476
478
477
479
478 def test_time_last_not_expression():
480 def test_time_last_not_expression():
479 ip.run_cell("%%time\n"
481 _ip.run_cell("%%time\n"
480 "var_1 = 1\n"
482 "var_1 = 1\n"
481 "var_2 = 2\n")
483 "var_2 = 2\n")
482 assert ip.user_ns['var_1'] == 1
484 assert _ip.user_ns['var_1'] == 1
483 del ip.user_ns['var_1']
485 del _ip.user_ns['var_1']
484 assert ip.user_ns['var_2'] == 2
486 assert _ip.user_ns['var_2'] == 2
485 del ip.user_ns['var_2']
487 del _ip.user_ns['var_2']
486
488
487
489
488 @dec.skip_win32
490 @dec.skip_win32
@@ -964,7 +966,7 class CellMagicTestCase(TestCase):
964 self.check_ident('cellm4')
966 self.check_ident('cellm4')
965 # Check that nothing is registered as 'cellm33'
967 # Check that nothing is registered as 'cellm33'
966 c33 = _ip.find_cell_magic('cellm33')
968 c33 = _ip.find_cell_magic('cellm33')
967 assert c33 == None
969 assert c33 is None
968
970
969 def test_file():
971 def test_file():
970 """Basic %%writefile"""
972 """Basic %%writefile"""
@@ -1097,7 +1099,7 def test_file_amend():
1097 def test_file_spaces():
1099 def test_file_spaces():
1098 """%%file with spaces in filename"""
1100 """%%file with spaces in filename"""
1099 ip = get_ipython()
1101 ip = get_ipython()
1100 with TemporaryWorkingDirectory() as td:
1102 with TemporaryWorkingDirectory():
1101 fname = "file name"
1103 fname = "file name"
1102 ip.run_cell_magic(
1104 ip.run_cell_magic(
1103 "file",
1105 "file",
@@ -1502,18 +1504,16 def load_ipython_extension(ipython):
1502
1504
1503 def test_lazy_magics():
1505 def test_lazy_magics():
1504 with pytest.raises(UsageError):
1506 with pytest.raises(UsageError):
1505 ip.run_line_magic("lazy_line", "")
1507 _ip.run_line_magic("lazy_line", "")
1506
1507 startdir = os.getcwd()
1508
1508
1509 with TemporaryDirectory() as tmpdir:
1509 with TemporaryDirectory() as tmpdir:
1510 with prepended_to_syspath(tmpdir):
1510 with prepended_to_syspath(tmpdir):
1511 ptempdir = Path(tmpdir)
1511 ptempdir = Path(tmpdir)
1512 tf = ptempdir / "lazy_magic_module.py"
1512 tf = ptempdir / "lazy_magic_module.py"
1513 tf.write_text(MINIMAL_LAZY_MAGIC)
1513 tf.write_text(MINIMAL_LAZY_MAGIC)
1514 ip.magics_manager.register_lazy("lazy_line", Path(tf.name).name[:-3])
1514 _ip.magics_manager.register_lazy("lazy_line", Path(tf.name).name[:-3])
1515 with tt.AssertPrints("Lazy Line"):
1515 with tt.AssertPrints("Lazy Line"):
1516 ip.run_line_magic("lazy_line", "")
1516 _ip.run_line_magic("lazy_line", "")
1517
1517
1518
1518
1519 TEST_MODULE = """
1519 TEST_MODULE = """
@@ -90,6 +90,7 def ghissue_role(name, rawtext, text, lineno, inliner, options=None, content=Non
90 '"%s" is invalid.' % name, line=lineno)
90 '"%s" is invalid.' % name, line=lineno)
91 prb = inliner.problematic(rawtext, rawtext, msg)
91 prb = inliner.problematic(rawtext, rawtext, msg)
92 return [prb], [msg]
92 return [prb], [msg]
93 app = inliner.document.settings.env.app
93 node = make_link_node(rawtext, app, category, str(issue_num), options)
94 node = make_link_node(rawtext, app, category, str(issue_num), options)
94 return [node], []
95 return [node], []
95
96
General Comments 0
You need to be logged in to leave comments. Login now