Show More
@@ -68,7 +68,7 b' def test_get_ipython_dir_2():' | |||
|
68 | 68 | assert ipdir == os.path.join("someplace", ".ipython") |
|
69 | 69 | |
|
70 | 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 | 72 | tmphome = TemporaryDirectory() |
|
73 | 73 | try: |
|
74 | 74 | with patch_get_home_dir(tmphome.name), \ |
@@ -80,10 +80,8 b' def test_get_ipython_dir_3():' | |||
|
80 | 80 | }), warnings.catch_warnings(record=True) as w: |
|
81 | 81 | ipdir = paths.get_ipython_dir() |
|
82 | 82 | |
|
83 |
assert ipdir == os.path.join(tmphome.name, " |
|
|
84 | if sys.platform != 'darwin': | |
|
85 | assert len(w) == 1 | |
|
86 | assert "Moving" in str(w[0]) | |
|
83 | assert ipdir == os.path.join(tmphome.name, XDG_TEST_DIR, "ipython") | |
|
84 | assert len(w) == 0 | |
|
87 | 85 | finally: |
|
88 | 86 | tmphome.cleanup() |
|
89 | 87 | |
@@ -105,10 +103,8 b' def test_get_ipython_dir_4():' | |||
|
105 | 103 | }), warnings.catch_warnings(record=True) as w: |
|
106 | 104 | ipdir = paths.get_ipython_dir() |
|
107 | 105 | |
|
108 | assert ipdir == os.path.join(HOME_TEST_DIR, ".ipython") | |
|
109 | if sys.platform != 'darwin': | |
|
110 | assert len(w) == 1 | |
|
111 | assert "Ignoring" in str(w[0]) | |
|
106 | assert len(w) == 1 | |
|
107 | assert "Ignoring" in str(w[0]) | |
|
112 | 108 | |
|
113 | 109 | |
|
114 | 110 | def test_get_ipython_dir_5(): |
@@ -179,7 +175,7 b' def test_get_ipython_dir_8():' | |||
|
179 | 175 | |
|
180 | 176 | def test_get_ipython_cache_dir(): |
|
181 | 177 | with modified_env({'HOME': HOME_TEST_DIR}): |
|
182 |
if os.name == |
|
|
178 | if os.name == "posix": | |
|
183 | 179 | # test default |
|
184 | 180 | os.makedirs(os.path.join(HOME_TEST_DIR, ".cache")) |
|
185 | 181 | with modified_env({'XDG_CACHE_HOME': None}): |
@@ -54,8 +54,7 b' def get_ipython_dir() -> str:' | |||
|
54 | 54 | warn(('{0} is deprecated. Move link to {1} to ' |
|
55 | 55 | 'get rid of this message').format(cu(xdg_ipdir), cu(ipdir))) |
|
56 | 56 | else: |
|
57 | warn('Moving {0} to {1}'.format(cu(xdg_ipdir), cu(ipdir))) | |
|
58 | shutil.move(xdg_ipdir, ipdir) | |
|
57 | ipdir = xdg_ipdir | |
|
59 | 58 | |
|
60 | 59 | ipdir = os.path.normpath(os.path.expanduser(ipdir)) |
|
61 | 60 |
@@ -205,7 +205,7 b' def get_xdg_dir():' | |||
|
205 | 205 | |
|
206 | 206 | env = os.environ |
|
207 | 207 | |
|
208 | if os.name == 'posix' and sys.platform != 'darwin': | |
|
208 | if os.name == "posix": | |
|
209 | 209 | # Linux, Unix, AIX, etc. |
|
210 | 210 | # use ~/.config if empty OR not set |
|
211 | 211 | xdg = env.get("XDG_CONFIG_HOME", None) or os.path.join(get_home_dir(), '.config') |
@@ -224,7 +224,7 b' def get_xdg_cache_dir():' | |||
|
224 | 224 | |
|
225 | 225 | env = os.environ |
|
226 | 226 | |
|
227 | if os.name == 'posix' and sys.platform != 'darwin': | |
|
227 | if os.name == "posix": | |
|
228 | 228 | # Linux, Unix, AIX, etc. |
|
229 | 229 | # use ~/.cache if empty OR not set |
|
230 | 230 | xdg = env.get("XDG_CACHE_HOME", None) or os.path.join(get_home_dir(), '.cache') |
@@ -238,11 +238,11 b' def test_get_xdg_dir_2():' | |||
|
238 | 238 | |
|
239 | 239 | @with_environment |
|
240 | 240 | def test_get_xdg_dir_3(): |
|
241 |
"""test_get_xdg_dir_3, check xdg_dir not used on |
|
|
241 | """test_get_xdg_dir_3, check xdg_dir not used on non-posix systems""" | |
|
242 | 242 | reload(path) |
|
243 | 243 | path.get_home_dir = lambda : HOME_TEST_DIR |
|
244 |
os.name = " |
|
|
245 |
sys.platform = " |
|
|
244 | os.name = "nt" | |
|
245 | sys.platform = "win32" | |
|
246 | 246 | env.pop('IPYTHON_DIR', None) |
|
247 | 247 | env.pop('IPYTHONDIR', None) |
|
248 | 248 | env.pop('XDG_CONFIG_HOME', None) |
General Comments 0
You need to be logged in to leave comments.
Login now