Skip to content

Commit

Permalink
check-files: add progressbar
Browse files Browse the repository at this point in the history
  • Loading branch information
avivace committed Mar 16, 2024
1 parent 6ceabee commit f1e7cf3
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/check_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@

import json
import os
import progressbar


path = "../entries/"
games_list = os.listdir(path)

for game in games_list:

for game in progressbar.progressbar(games_list, redirect_stdout=True):
with open(f"../entries/{game}/game.json") as f:
game = json.load(f)
print(f"Checking {game['slug']}..")
for file in game["files"]:
if file["filename"] not in os.listdir(f"{path}/{game['slug']}"):
raise Exception(f'{file["filename"]} found in manifest but not on disk (entry {game["slug"]})')
raise Exception(
f'{file["filename"]} found in manifest but not on disk (entry {game["slug"]})'
)
for screenshot in game["screenshots"]:
if screenshot not in os.listdir(f"{path}/{game['slug']}"):
raise Exception(f'{screenshot} found in manifest but not on disk (entry {game["slug"]})')
print(f"{game['slug']}: {len(game['files'])} file(s), {len(game['screenshots'])} screenshot(s)")
raise Exception(
f'{screenshot} found in manifest but not on disk (entry {game["slug"]})'
)
print(
f"{game['slug']}: {len(game['files'])} file(s), {len(game['screenshots'])} screenshot(s)"
)

0 comments on commit f1e7cf3

Please sign in to comment.