##// END OF EJS Templates
[extensions][tests][storemagic] Remove nose
Samuel Gaist -
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 nt.assert_equal(ip.db['autorestore/foo'], 78)
25 assert ip.db["autorestore/foo"] == 78
27 nt.assert_in('bar', ip.db['stored_aliases'])
26 assert "bar" in ip.db["stored_aliases"]
28 nt.assert_equal(ip.db['autorestore/foobar'], 79)
27 assert ip.db["autorestore/foobar"] == 79
29 nt.assert_equal(ip.db['autorestore/foobaz'], '80')
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('store -r foo bar foobar foobaz')
39 ip.magic("store -r foo bar foobar foobaz")
41 nt.assert_equal(ip.user_ns['foo'], 78)
40 assert ip.user_ns["foo"] == 78
42 assert ip.alias_manager.is_alias('bar')
41 assert ip.alias_manager.is_alias("bar")
43 nt.assert_equal(ip.user_ns['foobar'], 79)
42 assert ip.user_ns["foobar"] == 79
44 nt.assert_equal(ip.user_ns['foobaz'], '80')
43 assert ip.user_ns["foobaz"] == "80"
45
44
46 ip.magic('store -r') # restores _dh too
45 ip.magic("store -r") # restores _dh too
47 nt.assert_in(os.path.realpath(tmpd), ip.user_ns['_dh'])
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('storemagic')
59 ip.extension_manager.reload_extension("storemagic")
61 nt.assert_not_in('foo', ip.user_ns)
60 assert "foo" not in ip.user_ns
62 c.StoreMagics.autorestore = True
61 c.StoreMagics.autorestore = True
63 ip.extension_manager.reload_extension('storemagic')
62 ip.extension_manager.reload_extension("storemagic")
64 nt.assert_equal(ip.user_ns['foo'], 95)
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