()
| 250 | |
| 251 | @pytest.mark.skipif(sys.platform != 'win32', reason='Windows only') |
| 252 | def test_user_fonts_win32(): |
| 253 | if not (os.environ.get('APPVEYOR') or os.environ.get('TF_BUILD')): |
| 254 | pytest.xfail("This test should only run on CI (appveyor or azure) " |
| 255 | "as the developer's font directory should remain " |
| 256 | "unchanged.") |
| 257 | pytest.xfail("We need to update the registry for this test to work") |
| 258 | font_test_file = 'mpltest.ttf' |
| 259 | |
| 260 | # Precondition: the test font should not be available |
| 261 | fonts = findSystemFonts() |
| 262 | if any(font_test_file in font for font in fonts): |
| 263 | pytest.skip(f'{font_test_file} already exists in system fonts') |
| 264 | |
| 265 | user_fonts_dir = MSUserFontDirectories[0] |
| 266 | |
| 267 | # Make sure that the user font directory exists (this is probably not the |
| 268 | # case on Windows versions < 1809) |
| 269 | os.makedirs(user_fonts_dir) |
| 270 | |
| 271 | # Copy the test font to the user font directory |
| 272 | shutil.copy(Path(__file__).parent / 'data' / font_test_file, user_fonts_dir) |
| 273 | |
| 274 | # Now, the font should be available |
| 275 | fonts = findSystemFonts() |
| 276 | assert any(font_test_file in font for font in fonts) |
| 277 | |
| 278 | |
| 279 | def _model_handler(_): |
nothing calls this directly
no test coverage detected
searching dependent graphs…