Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d994662

Browse files
committed
Backport PR ipython#2864: Fix %run -t -N<N> TypeError
Adds a test case and a fix for issue ipython#2784.
1 parent 25cdca4 commit d994662

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

IPython/core/magics/execution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def run(self, parameter_s='', runner=None,
611611
t_sys = t1[1] - t0[1]
612612
print "\nIPython CPU timings (estimated):"
613613
print "Total runs performed:", nruns
614-
print " Times : %10.2f %10.2f" % ('Total', 'Per run')
614+
print " Times : %10s %10s" % ('Total', 'Per run')
615615
print " User : %10.2f s, %10.2f s." % (t_usr, t_usr / nruns)
616616
print " System : %10.2f s, %10.2f s." % (t_sys, t_sys / nruns)
617617
twall1 = time.time()

IPython/core/tests/test_run.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,10 @@ def test_unicode(self):
248248
na = os.path.join(mydir, 'nonascii.py')
249249
_ip.magic('run "%s"' % na)
250250
tt.assert_equals(_ip.user_ns['u'], u'Ўт№Ф')
251+
252+
def test_run_formatting(self):
253+
""" Test that %run -t -N<N> does not raise a TypeError for N > 1."""
254+
src = "pass"
255+
self.mktmp(src)
256+
_ip.magic('run -t -N 1 %s' % self.fname)
257+
_ip.magic('run -t -N 10 %s' % self.fname)

0 commit comments

Comments
 (0)