fabro(01KT9X0N42W6PRBVH2N5914EQJ): impl_setup (succeeded)

Fabro-Run: 01KT9X0N42W6PRBVH2N5914EQJ
Fabro-Completed: 3
Fabro-Checkpoint: 318fc6b17d

⚒️ Generated with [Fabro](https://fabro.sh)
This commit is contained in:
Fabro 2026-06-04 18:17:50 +00:00
parent df1e9e39f6
commit 15fffe6b88
8 changed files with 80 additions and 9 deletions

29
solitaire-app/README.md Normal file
View file

@ -0,0 +1,29 @@
# Terminal Klondike Solitaire
A terminal-based Klondike Solitaire game in Python 3.11+ using the standard `curses` library.
## Features
- Standard Draw-One Klondike Solitaire rules
- Fully keyboard-driven curses TUI
- Unlimited Undo functionality
- Auto-move to foundations
- Fully testable pure Python core game engine
## Installation & Running
To run the game, use:
```bash
python3 main.py
```
To run smoke tests (non-interactive):
```bash
python3 main.py --smoke
```
## Testing
To run the automated tests using pytest:
```bash
cd solitaire-app
pytest
```

View file

@ -1,15 +1,24 @@
import sys
import os
import argparse
import unittest
# Ensure the "src" directory and current directory are on sys.path so imports work seamlessly
current_dir = os.path.dirname(os.path.abspath(__file__))
src_dir = os.path.join(current_dir, "src")
if src_dir not in sys.path:
sys.path.insert(0, src_dir)
if current_dir not in sys.path:
sys.path.insert(1, current_dir)
def run_smoke_test() -> None:
"""Proves imports work, instantiates core classes, and runs self-tests."""
print("Running Solitaire smoke tests...")
# 1. Test Imports
try:
from game import Card, GameState
from ui import SolitaireTUI
from solitaire_tui.game import Card, GameState
from solitaire_tui.ui import SolitaireTUI
print("✓ Successfully imported core modules (game, ui).")
except Exception as e:
print(f"✗ Failed to import core modules: {e}")
@ -29,9 +38,14 @@ def run_smoke_test() -> None:
# 3. Run full unit tests to confirm rule-engine validity
print("Running automated unit tests...")
loader = unittest.TestLoader()
# Discover and run tests in the solitaire-app folder
from test_game import TestSolitaireGame
suite = loader.loadTestsFromTestCase(TestSolitaireGame)
# Discover and run tests
try:
from tests.test_game import TestSolitaireGame
suite = loader.loadTestsFromTestCase(TestSolitaireGame)
except Exception as e:
print(f"✗ Failed to import tests: {e}")
sys.exit(1)
runner = unittest.TextTestRunner(verbosity=1)
result = runner.run(suite)
@ -58,8 +72,8 @@ def main() -> None:
# Normal execution starts curses-based TUI
import curses
from game import GameState
from ui import SolitaireTUI
from solitaire_tui.game import GameState
from solitaire_tui.ui import SolitaireTUI
game = GameState()
tui = SolitaireTUI(game)

View file

@ -0,0 +1,26 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "solitaire-tui"
version = "0.1.0"
description = "A terminal-based Klondike solitaire game in Python with a curses TUI"
readme = "README.md"
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = []
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q"
testpaths = [
"tests",
]
pythonpath = [
"src"
]

View file

@ -0,0 +1 @@
# solitaire_tui package

View file

@ -1,5 +1,5 @@
import curses
from game import GameState, Card
from .game import GameState, Card
from typing import Optional, Tuple
class SolitaireTUI:

View file

@ -0,0 +1 @@
# tests package

View file

@ -1,5 +1,5 @@
import unittest
from game import GameState, Card
from solitaire_tui.game import GameState, Card
class TestSolitaireGame(unittest.TestCase):
def setUp(self):