test_get_ipython_dir_4, warn if XDG and home both exist.
()
| 89 | tmphome.cleanup() |
| 90 | |
| 91 | def 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 | |
| 114 | def test_get_ipython_dir_5(): |
| 115 | """test_get_ipython_dir_5, use .ipython if exists and XDG defined, but doesn't exist.""" |
nothing calls this directly
no test coverage detected