()
| 109 | reason="Unicode issues with scandir on PyPy, see https://github.com/pypy/pypy/issues/4860", |
| 110 | ) |
| 111 | def 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 | |
| 139 | def test_list_bundled_profiles(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…