LONG_EXAMPLE_FILE = data_file("long-example.beancount") EXAMPLE_FILE = data_file("example.beancount") EXAMPLE_LEDGER = FavaLedger(LONG_EXAMPLE_FILE) fava_app.testing = True TEST_CLIENT = fava_app.test_client() fava_app.config["BEANCOUNT_FILES"] = [ LONG_EXAMPLE_FILE, EXAMPLE_FILE, data_file("extension-report-example.beancount"), data_file("import.beancount"), data_file("query-example.beancount"), ] _load_file() SNAPSHOT_UPDATE = bool(os.environ.get("SNAPSHOT_UPDATE")) MSG = "Maybe snapshots need to be updated with `SNAPSHOT_UPDATE=1 make test`?" # Keep track of multiple calls to snapshot in one test function to generate # unique (simply numbered) file names for the snashop files. SNAPS: Counter[Path] = Counter() SnapshotFunc = Callable[[Any], None] @pytest.fixture() def snapshot(request: FixtureRequest) -> SnapshotFunc: file_path = Path(getattr(request, "path", getattr(request, "fspath"))) fn_name = request.function.__name__
def create_app(bfile): key = "BEANCOUNT_FILES" if (key not in fava_app.config) or (fava_app.config[key] != [bfile]): fava_app.config[key] = [bfile] _load_file()