MCPcopy
hub / github.com/getpelican/pelican / test_page_ignore_cache

Method test_page_ignore_cache

pelican/tests/test_cache.py:323–354  ·  view source on GitHub ↗

Test that all the pages are read again when not loading cache used in --ignore_cache or autoreload mode

(self)

Source from the content-addressed store, hash-verified

321 self.assertEqual(reader.read.call_count, 0)
322
323 def test_page_ignore_cache(self):
324 """Test that all the pages are read again when not loading cache
325
326 used in --ignore_cache or autoreload mode"""
327 settings = self._get_cache_enabled_settings()
328 settings["PAGE_PATHS"] = ["TestPages"]
329 settings["READERS"] = {"asc": None}
330 context = get_context(settings)
331
332 generator = PagesGenerator(
333 context=context.copy(),
334 settings=settings,
335 path=CUR_DIR,
336 theme=settings["THEME"],
337 output_path=None,
338 )
339 generator.readers.read_file = MagicMock()
340 generator.generate_context()
341 self.assertTrue(hasattr(generator, "_cache_open"))
342 orig_call_count = generator.readers.read_file.call_count
343
344 settings["LOAD_CONTENT_CACHE"] = False
345 generator = PagesGenerator(
346 context=context.copy(),
347 settings=settings,
348 path=CUR_DIR,
349 theme=settings["THEME"],
350 output_path=None,
351 )
352 generator.readers.read_file = MagicMock()
353 generator.generate_context()
354 self.assertEqual(generator.readers.read_file.call_count, orig_call_count)

Callers

nothing calls this directly

Calls 4

generate_contextMethod · 0.95
get_contextFunction · 0.90
PagesGeneratorClass · 0.90

Tested by

no test coverage detected