Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Run p ( https://github.com/ipython/ipython/pull/901 ) #916

Closed
wants to merge 2 commits into from

3 participants

@alcidesv

This is regarding:

#901

I have included the patch and the test case. I controlled the number of tests passing before the test-case, after the test case but before the patch, and after the patch, and there seems to be no collateral damage...

Thanks for the help on running the test cases, I got it working.

Alcides added some commits
Alcides - Test case correctly fails.
  - Error stats for bin/iptest3 IPython.core.tests.test_run are:

Ran 11 tests in 0.190s

FAILED (KNOWNFAIL=1, errors=3)
9f8864d
Alcides - Patch applied. 6639b39
@alcidesv

Btw, I opened a new pull request because I had deleted the branch for 901. Sorry for the fuzz.

@fperez
Owner

@takluyver, this one is a restart of #901 that you were already looking into. Do you need a hand to wrap it up? I'll be happy to help if you need, otherwise I'll leave it in your hands.

@dsign, thanks again for the contribution!

@takluyver
Owner

Sorry, it got buried in tabs. Thanks for the reminder - I'll get onto it now.

@takluyver
Owner

Rebased and merged as commits 7d5fdcc and 36c1b75 . Thanks, @dsign.

@takluyver takluyver closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 21, 2011
  1. - Test case correctly fails.

    Alcides authored
      - Error stats for bin/iptest3 IPython.core.tests.test_run are:
    
    Ran 11 tests in 0.190s
    
    FAILED (KNOWNFAIL=1, errors=3)
  2. - Patch applied.

    Alcides authored
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 2 deletions.
  1. +5 −1 IPython/core/magic.py
  2. +13 −1 IPython/core/tests/test_run.py
View
6 IPython/core/magic.py
@@ -1382,7 +1382,11 @@ def magic_prun(self, parameter_s ='',user_mode=1,
return
arg_str = 'execfile(filename,prog_ns)'
- namespace = locals()
+ namespace = {
+ 'execfile': self.shell.safe_execfile,
+ 'prog_ns': prog_ns,
+ 'filename': filename
+ }
opts.merge(opts_def)
View
14 IPython/core/tests/test_run.py
@@ -111,12 +111,18 @@ class TestMagicRunPass(tt.TempFileMixin):
def setup(self):
"""Make a valid python temp file."""
self.mktmp('pass\n')
-
+
def run_tmpfile(self):
_ip = get_ipython()
# This fails on Windows if self.tmpfile.name has spaces or "~" in it.
# See below and ticket https://bugs.launchpad.net/bugs/366353
_ip.magic('run %s' % self.fname)
+
+ def run_tmpfile_p(self):
+ _ip = get_ipython()
+ # This fails on Windows if self.tmpfile.name has spaces or "~" in it.
+ # See below and ticket https://bugs.launchpad.net/bugs/366353
+ _ip.magic('run -p %s' % self.fname)
def test_builtins_id(self):
"""Check that %run doesn't damage __builtins__ """
@@ -144,6 +150,12 @@ def test_prompts(self):
_ip = get_ipython()
p2 = str(_ip.displayhook.prompt2).strip()
nt.assert_equals(p2[:3], '...')
+
+ def test_run_profile( self ):
+ """Test that the option -p, which invokes the profiler, do not
+ crash by invoking execfile"""
+ _ip = get_ipython()
+ self.run_tmpfile_p()
class TestMagicRunSimple(tt.TempFileMixin):
Something went wrong with that request. Please try again.