Skip to content

Commit

Permalink
Add a failing test for "%run -p -m ..."
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Mar 23, 2013
1 parent 4103901 commit c809a13
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions IPython/core/tests/test_run.py
Expand Up @@ -379,8 +379,8 @@ def tearDown(self):
sys.path[:] = filter(lambda x: x != self.tempdir.name, sys.path) sys.path[:] = filter(lambda x: x != self.tempdir.name, sys.path)
self.tempdir.cleanup() self.tempdir.cleanup()


def check_run_submodule(self, submodule): def check_run_submodule(self, submodule, opts=''):
_ip.magic('run -m {0}.{1}'.format(self.package, submodule)) _ip.magic('run {2} -m {0}.{1}'.format(self.package, submodule, opts))
self.assertEqual(_ip.user_ns['x'], self.value, self.assertEqual(_ip.user_ns['x'], self.value,
'Variable `x` is not loaded from module `{0}`.' 'Variable `x` is not loaded from module `{0}`.'
.format(submodule)) .format(submodule))
Expand All @@ -391,3 +391,9 @@ def test_run_submodule_with_absolute_import(self):
def test_run_submodule_with_relative_import(self): def test_run_submodule_with_relative_import(self):
"""Run submodule that has a relative import statement (#2727).""" """Run submodule that has a relative import statement (#2727)."""
self.check_run_submodule('relative') self.check_run_submodule('relative')

def test_prun_submodule_with_absolute_import(self):
self.check_run_submodule('absolute', '-p')

def test_prun_submodule_with_relative_import(self):
self.check_run_submodule('relative', '-p')

0 comments on commit c809a13

Please sign in to comment.