##// END OF EJS Templates
Use default OS shell to run system commands...
Use default OS shell to run system commands Instead of using os.system which uses /bin/sh, this uses subprocess.call (the replacement of os.system) to run the command using the default shell of the OS. With this, one can use more advanced commands for bash, zsh, ksh, ... I do not have a win32 system to test this modification, so maybe line 2236 can also be changed like 2239.

File last commit:

r11361:707f09d7
r12217:56bf2f98
Show More
test_storemagic.py
32 lines | 812 B | text/x-python | PythonLexer
Thomas Kluyver
Add test for storemagic
r11146 import tempfile, os
import nose.tools as nt
ip = get_ipython()
ip.magic('load_ext storemagic')
def test_store_restore():
ip.user_ns['foo'] = 78
ip.magic('alias bar echo "hello"')
tmpd = tempfile.mkdtemp()
ip.magic('cd ' + tmpd)
ip.magic('store foo')
ip.magic('store bar')
# Check storing
nt.assert_equal(ip.db['autorestore/foo'], 78)
nt.assert_in('bar', ip.db['stored_aliases'])
# Remove those items
ip.user_ns.pop('foo', None)
ip.alias_manager.undefine_alias('bar')
ip.magic('cd -')
ip.user_ns['_dh'][:] = []
# Check restoring
ip.magic('store -r')
nt.assert_equal(ip.user_ns['foo'], 78)
nt.assert_in('bar', ip.alias_manager.alias_table)
Jens Hedegaard Nielsen
Store magic test. On MacOSX the temp dir in /var is symlinked into /private/var thus making this comparison fail. This is solved by using os.path.realpath to expand the tempdir into is's real directory.
r11361 nt.assert_in(os.path.realpath(tmpd), ip.user_ns['_dh'])
Thomas Kluyver
Add test for storemagic
r11146
os.rmdir(tmpd)