##// END OF EJS Templates
do not use .magic(...) that has been deprecated for a decade (#14566)
M Bussonnier -
r28950:ac9ed9c1 merge
parent child Browse files
Show More
@@ -472,7 +472,7 b' Currently the magic system has the following functions:""",'
472 472 ptformatter.pprint = dstore.rc_pprint
473 473 disp_formatter.active_types = dstore.rc_active_types
474 474
475 shell.magic('xmode ' + dstore.xmode)
475 shell.run_line_magic("xmode", dstore.xmode)
476 476
477 477 # mode here is the state before we switch; switch_doctest_mode takes
478 478 # the mode we're switching to.
@@ -21,7 +21,7 b' def test_logstart_unicode():'
21 21 logfname = os.path.join(tdir, "test_unicode.log")
22 22 _ip.run_cell("'abc€'")
23 23 try:
24 _ip.magic("logstart -to %s" % logfname)
24 _ip.run_line_magic("logstart", "-to %s" % logfname)
25 25 _ip.run_cell("'abc€'")
26 26 finally:
27 27 _ip.logger.logstop()
@@ -827,7 +827,7 b' def test_prun_special_syntax():'
827 827 @dec.skipif(execution.profile is None)
828 828 def test_prun_quotes():
829 829 "Test that prun does not clobber string escapes (GH #1302)"
830 _ip.magic(r"prun -q x = '\t'")
830 _ip.run_line_magic("prun", r"-q x = '\t'")
831 831 assert _ip.user_ns["x"] == "\t"
832 832
833 833
@@ -838,7 +838,7 b' def test_extension():'
838 838 print(' ', p)
839 839 print('CWD', os.getcwd())
840 840
841 pytest.raises(ImportError, _ip.magic, "load_ext daft_extension")
841 pytest.raises(ImportError, _ip.run_line_magic, "load_ext", "daft_extension")
842 842 daft_path = os.path.join(os.path.dirname(__file__), "daft_extension")
843 843 sys.path.insert(0, daft_path)
844 844 try:
@@ -271,10 +271,10 b' class TestMagicRunSimple(tt.TempFileMixin):'
271 271 "ip = get_ipython()\n"
272 272 "for i in range(5):\n"
273 273 " try:\n"
274 " ip.magic(%r)\n"
274 " ip.run_line_magic(%r, %r)\n"
275 275 " except NameError as e:\n"
276 276 " print(i)\n"
277 " break\n" % ("run " + empty.fname)
277 " break\n" % ("run", empty.fname)
278 278 )
279 279 self.mktmp(src)
280 280 _ip.run_line_magic("run", str(self.fname))
@@ -339,7 +339,7 b' tclass.py: deleting object: C-third'
339 339 """Check that files in odd encodings are accepted."""
340 340 mydir = os.path.dirname(__file__)
341 341 na = os.path.join(mydir, "nonascii.py")
342 _ip.magic('run "%s"' % na)
342 _ip.run_line_magic("run", na)
343 343 assert _ip.user_ns["u"] == "Ўт№Ф"
344 344
345 345 def test_run_py_file_attribute(self):
@@ -175,7 +175,8 b' class IndentationErrorTest(unittest.TestCase):'
175 175
176 176 with tt.AssertPrints("IndentationError"):
177 177 with tt.AssertPrints("zoom()", suppress=False):
178 ip.magic('run %s' % fname)
178 ip.run_line_magic("run", fname)
179
179 180
180 181 @skip_without("pandas")
181 182 def test_dynamic_code():
@@ -237,7 +238,7 b' bar()'
237 238 f.write(se_file_1)
238 239
239 240 with tt.AssertPrints(["7/", "SyntaxError"]):
240 ip.magic("run " + fname)
241 ip.run_line_magic("run", fname)
241 242
242 243 # Modify the file
243 244 with open(fname, "w", encoding="utf-8") as f:
@@ -245,7 +246,7 b' bar()'
245 246
246 247 # The SyntaxError should point to the correct line
247 248 with tt.AssertPrints(["7/", "SyntaxError"]):
248 ip.magic("run " + fname)
249 ip.run_line_magic("run", fname)
249 250
250 251 def test_non_syntaxerror(self):
251 252 # SyntaxTB may be called with an error other than a SyntaxError
General Comments 0
You need to be logged in to leave comments. Login now