Show More
@@ -1,5 +1,6 b'' | |||||
1 | import tempfile, os |
|
1 | import tempfile, os | |
2 |
|
2 | |||
|
3 | from IPython.config.loader import Config | |||
3 | import nose.tools as nt |
|
4 | import nose.tools as nt | |
4 |
|
5 | |||
5 | ip = get_ipython() |
|
6 | ip = get_ipython() | |
@@ -30,3 +31,20 b' def test_store_restore():' | |||||
30 | nt.assert_in(os.path.realpath(tmpd), ip.user_ns['_dh']) |
|
31 | nt.assert_in(os.path.realpath(tmpd), ip.user_ns['_dh']) | |
31 |
|
32 | |||
32 | os.rmdir(tmpd) |
|
33 | os.rmdir(tmpd) | |
|
34 | ||||
|
35 | def test_autorestore(): | |||
|
36 | ip.user_ns['foo'] = 95 | |||
|
37 | ip.magic('store foo') | |||
|
38 | del ip.user_ns['foo'] | |||
|
39 | c = Config() | |||
|
40 | c.StoreMagics.autorestore = False | |||
|
41 | orig_config = ip.config | |||
|
42 | try: | |||
|
43 | ip.config = c | |||
|
44 | ip.extension_manager.reload_extension('storemagic') | |||
|
45 | nt.assert_not_in('foo', ip.user_ns) | |||
|
46 | c.StoreMagics.autorestore = True | |||
|
47 | ip.extension_manager.reload_extension('storemagic') | |||
|
48 | nt.assert_equal(ip.user_ns['foo'], 95) | |||
|
49 | finally: | |||
|
50 | ip.config = orig_config |
General Comments 0
You need to be logged in to leave comments.
Login now