MCPcopy Index your code
hub / github.com/ipython/ipython / test_list_profiles_in

Function test_list_profiles_in

tests/test_profile.py:111–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109 reason="Unicode issues with scandir on PyPy, see https://github.com/pypy/pypy/issues/4860",
110)
111def test_list_profiles_in():
112 # No need to remove these directories and files, as they will get nuked in
113 # the module-level teardown.
114 td = Path(tempfile.mkdtemp(dir=TMP_TEST_DIR))
115 for name in ("profile_foo", "profile_hello", "not_a_profile"):
116 Path(td / name).mkdir(parents=True)
117 if dec.unicode_paths:
118 Path(td / "profile_ünicode").mkdir(parents=True)
119
120 with open(td / "profile_file", "w", encoding="utf-8") as f:
121 f.write("I am not a profile directory")
122 profiles = list_profiles_in(td)
123
124 # unicode normalization can turn u'ünicode' into u'u\0308nicode',
125 # so only check for *nicode, and that creating a ProfileDir from the
126 # name remains valid
127 found_unicode = False
128 for p in list(profiles):
129 if p.endswith("nicode"):
130 pd = ProfileDir.find_profile_dir_by_name(td, p)
131 profiles.remove(p)
132 found_unicode = True
133 break
134 if dec.unicode_paths:
135 assert found_unicode is True
136 assert set(profiles) == {"foo", "hello"}
137
138
139def test_list_bundled_profiles():

Callers

nothing calls this directly

Calls 4

list_profiles_inFunction · 0.90
writeMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…