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

Function test_get_ipython_dir_3

IPython/core/tests/test_paths.py:71–89  ·  view source on GitHub ↗

test_get_ipython_dir_3, move XDG if defined, and .ipython doesn't exist.

()

Source from the content-addressed store, hash-verified

69 nt.assert_equal(ipdir, os.path.join("someplace", ".ipython"))
70
71def test_get_ipython_dir_3():
72 """test_get_ipython_dir_3, move XDG if defined, and .ipython doesn't exist."""
73 tmphome = TemporaryDirectory()
74 try:
75 with patch_get_home_dir(tmphome.name), \
76 patch('os.name', 'posix'), \
77 modified_env({
78 'IPYTHON_DIR': None,
79 'IPYTHONDIR': None,
80 'XDG_CONFIG_HOME': XDG_TEST_DIR,
81 }), warnings.catch_warnings(record=True) as w:
82 ipdir = paths.get_ipython_dir()
83
84 nt.assert_equal(ipdir, os.path.join(tmphome.name, ".ipython"))
85 if sys.platform != 'darwin':
86 nt.assert_equal(len(w), 1)
87 nt.assert_in('Moving', str(w[0]))
88 finally:
89 tmphome.cleanup()
90
91def test_get_ipython_dir_4():
92 """test_get_ipython_dir_4, warn if XDG and home both exist."""

Callers

nothing calls this directly

Calls 2

patch_get_home_dirFunction · 0.85
cleanupMethod · 0.45

Tested by

no test coverage detected