##// END OF EJS Templates
Add a failing test for "%run -p -m ..."
Takafumi Arakaki -
Show More
@@ -379,8 +379,8 b' class TestMagicRunWithPackage(unittest.TestCase):'
379 sys.path[:] = filter(lambda x: x != self.tempdir.name, sys.path)
379 sys.path[:] = filter(lambda x: x != self.tempdir.name, sys.path)
380 self.tempdir.cleanup()
380 self.tempdir.cleanup()
381
381
382 def check_run_submodule(self, submodule):
382 def check_run_submodule(self, submodule, opts=''):
383 _ip.magic('run -m {0}.{1}'.format(self.package, submodule))
383 _ip.magic('run {2} -m {0}.{1}'.format(self.package, submodule, opts))
384 self.assertEqual(_ip.user_ns['x'], self.value,
384 self.assertEqual(_ip.user_ns['x'], self.value,
385 'Variable `x` is not loaded from module `{0}`.'
385 'Variable `x` is not loaded from module `{0}`.'
386 .format(submodule))
386 .format(submodule))
@@ -391,3 +391,9 b' class TestMagicRunWithPackage(unittest.TestCase):'
391 def test_run_submodule_with_relative_import(self):
391 def test_run_submodule_with_relative_import(self):
392 """Run submodule that has a relative import statement (#2727)."""
392 """Run submodule that has a relative import statement (#2727)."""
393 self.check_run_submodule('relative')
393 self.check_run_submodule('relative')
394
395 def test_prun_submodule_with_absolute_import(self):
396 self.check_run_submodule('absolute', '-p')
397
398 def test_prun_submodule_with_relative_import(self):
399 self.check_run_submodule('relative', '-p')
General Comments 0
You need to be logged in to leave comments. Login now