def test_pagelist(): page_manager = PageManager(DummyScreen()) pages = "" for n, page in page_manager.sorted_pages(): pages += f"{n} {page.title}\n" with open(os.path.join(_c.ceefax_path, "PAGES.md")) as f: assert f.read() == pages
class Ceefax: _instance = None def __init__(self, test=None): self.start_time = config.now() self.test = test self.page_manager = DummyPM() def begin(self): with Screen() as scr: self.page_manager = PageManager(scr) self.start_loop() def start_loop(self): self.page_manager.start_loop(self.test) def kill(self): raise KeyboardInterrupt
import pytest from ceefax.page import PageManager from ceefax.cupt import DummyScreen page_manager = PageManager(DummyScreen()) @pytest.mark.parametrize("pnum", page_manager.pages.keys()) def test_all_pages(pnum): page = page_manager.pages[pnum] if page.background is not None: page.background() page.reload() page.generate_content()
#!/usr/bin/env python3 from ceefax import config from ceefax.page import PageManager from ceefax.cupt import DummyScreen import os import config as _c config.ceefax_path = os.path.dirname(os.path.realpath(__file__)) config.pages_dir = os.path.join(config.ceefax_path, "pages") config.NAME = "HUSFAX" for i, j in _c.__dict__.items(): setattr(config, i, j) page_manager = PageManager(DummyScreen()) with open("PAGES.md", "w") as f: for n, page in page_manager.sorted_pages(): f.write(f"{n} {page.title}\n")
def begin(self): with Screen() as scr: self.page_manager = PageManager(scr) self.start_loop()
def __init__(self, test=None): self.start_time = config.now() self.test = test self.page_manager = DummyPM()