Skip to main content
tests/test_hosting.py · chapter Tests and team tooling, file 12 · 267 lines · open in the repository

What it does

Tests for the dashboard’s snapshot data, the live feed and the Hugging Face publishing (decisions 0010 and 0013).

What is inside

  • FakeHub() · line 187: Stands in for Hugging Face: keeps what each upload would have committed.
  • FakeHub.create_repo(self) · line 192
  • FakeHub.upload_folder(self, folder_path) · line 195
  • finished_batch(out, batch_id, day) · line 201

What it checks

  • trend forecast is the least squares line with a prediction interval (line 18)
  • trend forecast needs three years and skips missing ones (line 33)
  • yearly paths average the retailers on each window day (line 39)
  • event types that share every window are shown once (line 53)
  • window day d is scored by the prediction made the day before (line 66)
  • published tables never carry prices volumes or raw returns (line 78)
  • card templates start with metadata and use known placeholders (line 85)
  • every table in the dataset card is parquet (line 99)
  • the space is a free static page that embeds the hosted dashboard (line 108)
  • a live batch is published without price columns and only when finished (line 114)
  • published tables are split by year like the model (line 130)
  • a live run is live finished or stopped (line 137)
  • only a signed in member with write access publishes (line 152)
  • a new run never takes over a run that is streaming (line 174)
  • a restarted job carries on its run and uploads what it had left (line 208)
  • a job killed before finishing is marked stopped not complete (line 234)
  • the runner name can be set for the cloud streamer (line 251)
  • the cloud streamers copy holds what the demo needs and nothing else (line 257)

Connections

Uses: src/common/settings.py, src/common/study.py, src/hosting/live.py, src/hosting/publish_hf.py, src/hosting/snapshot.py, src/hosting/__init__.py

Source

tests/test_hosting.py