Show More
@@ -1,7 +1,6 b'' | |||||
1 | import tempfile, os |
|
1 | import tempfile, os | |
2 |
|
2 | |||
3 | from traitlets.config.loader import Config |
|
3 | from traitlets.config.loader import Config | |
4 | import nose.tools as nt |
|
|||
5 |
|
4 | |||
6 |
|
5 | |||
7 | def setup_module(): |
|
6 | def setup_module(): | |
@@ -23,10 +22,10 b' def test_store_restore():' | |||||
23 | ip.magic('store foobar foobaz') |
|
22 | ip.magic('store foobar foobaz') | |
24 |
|
23 | |||
25 | # Check storing |
|
24 | # Check storing | |
26 |
|
|
25 | assert ip.db["autorestore/foo"] == 78 | |
27 |
|
|
26 | assert "bar" in ip.db["stored_aliases"] | |
28 |
|
|
27 | assert ip.db["autorestore/foobar"] == 79 | |
29 |
|
|
28 | assert ip.db["autorestore/foobaz"] == "80" | |
30 |
|
29 | |||
31 | # Remove those items |
|
30 | # Remove those items | |
32 | ip.user_ns.pop('foo', None) |
|
31 | ip.user_ns.pop('foo', None) | |
@@ -37,14 +36,14 b' def test_store_restore():' | |||||
37 | ip.user_ns['_dh'][:] = [] |
|
36 | ip.user_ns['_dh'][:] = [] | |
38 |
|
37 | |||
39 | # Check restoring |
|
38 | # Check restoring | |
40 |
ip.magic( |
|
39 | ip.magic("store -r foo bar foobar foobaz") | |
41 |
|
|
40 | assert ip.user_ns["foo"] == 78 | |
42 |
assert ip.alias_manager.is_alias( |
|
41 | assert ip.alias_manager.is_alias("bar") | |
43 |
|
|
42 | assert ip.user_ns["foobar"] == 79 | |
44 |
|
|
43 | assert ip.user_ns["foobaz"] == "80" | |
45 |
|
44 | |||
46 |
ip.magic( |
|
45 | ip.magic("store -r") # restores _dh too | |
47 |
|
|
46 | assert os.path.realpath(tmpd) in ip.user_ns["_dh"] | |
48 |
|
47 | |||
49 | os.rmdir(tmpd) |
|
48 | os.rmdir(tmpd) | |
50 |
|
49 | |||
@@ -57,10 +56,10 b' def test_autorestore():' | |||||
57 | orig_config = ip.config |
|
56 | orig_config = ip.config | |
58 | try: |
|
57 | try: | |
59 | ip.config = c |
|
58 | ip.config = c | |
60 |
ip.extension_manager.reload_extension( |
|
59 | ip.extension_manager.reload_extension("storemagic") | |
61 |
|
|
60 | assert "foo" not in ip.user_ns | |
62 | c.StoreMagics.autorestore = True |
|
61 | c.StoreMagics.autorestore = True | |
63 |
ip.extension_manager.reload_extension( |
|
62 | ip.extension_manager.reload_extension("storemagic") | |
64 |
|
|
63 | assert ip.user_ns["foo"] == 95 | |
65 | finally: |
|
64 | finally: | |
66 | ip.config = orig_config |
|
65 | ip.config = orig_config |
General Comments 0
You need to be logged in to leave comments.
Login now