MCPcopy Create free account
hub / github.com/ipython/ipython / test_get_ipython_dir_4

Function test_get_ipython_dir_4

IPython/core/tests/test_paths.py:91–112  ·  view source on GitHub ↗

test_get_ipython_dir_4, warn if XDG and home both exist.

()

Source from the content-addressed store, hash-verified

89 tmphome.cleanup()
90
91def test_get_ipython_dir_4():
92 """test_get_ipython_dir_4, warn if XDG and home both exist."""
93 with patch_get_home_dir(HOME_TEST_DIR), \
94 patch('os.name', 'posix'):
95 try:
96 os.mkdir(os.path.join(XDG_TEST_DIR, 'ipython'))
97 except OSError as e:
98 if e.errno != errno.EEXIST:
99 raise
100
101
102 with modified_env({
103 'IPYTHON_DIR': None,
104 'IPYTHONDIR': None,
105 'XDG_CONFIG_HOME': XDG_TEST_DIR,
106 }), warnings.catch_warnings(record=True) as w:
107 ipdir = paths.get_ipython_dir()
108
109 nt.assert_equal(ipdir, os.path.join(HOME_TEST_DIR, ".ipython"))
110 if sys.platform != 'darwin':
111 nt.assert_equal(len(w), 1)
112 nt.assert_in('Ignoring', str(w[0]))
113
114def test_get_ipython_dir_5():
115 """test_get_ipython_dir_5, use .ipython if exists and XDG defined, but doesn't exist."""

Callers

nothing calls this directly

Calls 1

patch_get_home_dirFunction · 0.85

Tested by

no test coverage detected