Show More
@@ -68,7 +68,7 b' def test_get_ipython_dir_2():' | |||||
68 | assert ipdir == os.path.join("someplace", ".ipython") |
|
68 | assert ipdir == os.path.join("someplace", ".ipython") | |
69 |
|
69 | |||
70 | def test_get_ipython_dir_3(): |
|
70 | def test_get_ipython_dir_3(): | |
71 |
"""test_get_ipython_dir_3, |
|
71 | """test_get_ipython_dir_3, use XDG if defined and exists, and .ipython doesn't exist.""" | |
72 | tmphome = TemporaryDirectory() |
|
72 | tmphome = TemporaryDirectory() | |
73 | try: |
|
73 | try: | |
74 | with patch_get_home_dir(tmphome.name), \ |
|
74 | with patch_get_home_dir(tmphome.name), \ | |
@@ -80,10 +80,8 b' def test_get_ipython_dir_3():' | |||||
80 | }), warnings.catch_warnings(record=True) as w: |
|
80 | }), warnings.catch_warnings(record=True) as w: | |
81 | ipdir = paths.get_ipython_dir() |
|
81 | ipdir = paths.get_ipython_dir() | |
82 |
|
82 | |||
83 |
assert ipdir == os.path.join(tmphome.name, " |
|
83 | assert ipdir == os.path.join(tmphome.name, XDG_TEST_DIR, "ipython") | |
84 | if sys.platform != 'darwin': |
|
84 | assert len(w) == 0 | |
85 | assert len(w) == 1 |
|
|||
86 | assert "Moving" in str(w[0]) |
|
|||
87 | finally: |
|
85 | finally: | |
88 | tmphome.cleanup() |
|
86 | tmphome.cleanup() | |
89 |
|
87 | |||
@@ -105,10 +103,8 b' def test_get_ipython_dir_4():' | |||||
105 | }), warnings.catch_warnings(record=True) as w: |
|
103 | }), warnings.catch_warnings(record=True) as w: | |
106 | ipdir = paths.get_ipython_dir() |
|
104 | ipdir = paths.get_ipython_dir() | |
107 |
|
105 | |||
108 | assert ipdir == os.path.join(HOME_TEST_DIR, ".ipython") |
|
106 | assert len(w) == 1 | |
109 | if sys.platform != 'darwin': |
|
107 | assert "Ignoring" in str(w[0]) | |
110 | assert len(w) == 1 |
|
|||
111 | assert "Ignoring" in str(w[0]) |
|
|||
112 |
|
108 | |||
113 |
|
109 | |||
114 | def test_get_ipython_dir_5(): |
|
110 | def test_get_ipython_dir_5(): | |
@@ -179,7 +175,7 b' def test_get_ipython_dir_8():' | |||||
179 |
|
175 | |||
180 | def test_get_ipython_cache_dir(): |
|
176 | def test_get_ipython_cache_dir(): | |
181 | with modified_env({'HOME': HOME_TEST_DIR}): |
|
177 | with modified_env({'HOME': HOME_TEST_DIR}): | |
182 |
if os.name == |
|
178 | if os.name == "posix": | |
183 | # test default |
|
179 | # test default | |
184 | os.makedirs(os.path.join(HOME_TEST_DIR, ".cache")) |
|
180 | os.makedirs(os.path.join(HOME_TEST_DIR, ".cache")) | |
185 | with modified_env({'XDG_CACHE_HOME': None}): |
|
181 | with modified_env({'XDG_CACHE_HOME': None}): |
@@ -228,11 +228,11 b' def test_get_xdg_dir_2():' | |||||
228 |
|
228 | |||
229 | @with_environment |
|
229 | @with_environment | |
230 | def test_get_xdg_dir_3(): |
|
230 | def test_get_xdg_dir_3(): | |
231 |
"""test_get_xdg_dir_3, check xdg_dir not used on |
|
231 | """test_get_xdg_dir_3, check xdg_dir not used on non-posix systems""" | |
232 | reload(path) |
|
232 | reload(path) | |
233 | path.get_home_dir = lambda : HOME_TEST_DIR |
|
233 | path.get_home_dir = lambda : HOME_TEST_DIR | |
234 |
os.name = " |
|
234 | os.name = "nt" | |
235 |
sys.platform = " |
|
235 | sys.platform = "win32" | |
236 | env.pop('IPYTHON_DIR', None) |
|
236 | env.pop('IPYTHON_DIR', None) | |
237 | env.pop('IPYTHONDIR', None) |
|
237 | env.pop('IPYTHONDIR', None) | |
238 | env.pop('XDG_CONFIG_HOME', None) |
|
238 | env.pop('XDG_CONFIG_HOME', None) |
General Comments 0
You need to be logged in to leave comments.
Login now