Skip to content

Commit b1556b4

Browse files
authored
Merge pull request #33 from anhmtk/tests/smoke-suite-wave-05
test: add smoke suite (learning/framework) and CI (wave-05)
2 parents 2b32409 + 71454fd commit b1556b4

4 files changed

Lines changed: 237 additions & 1 deletion

File tree

.github/workflows/ci-smoke.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI – Smoke
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "tests/test_*smoke*.py"
7+
- "tests/test_*canary*.py"
8+
- "pytest.ini"
9+
- "stillme_core/**"
10+
- "agent_dev/**"
11+
- "framework.py"
12+
push:
13+
branches: [ main ]
14+
paths:
15+
- "tests/test_*smoke*.py"
16+
- "tests/test_*canary*.py"
17+
- "pytest.ini"
18+
- "stillme_core/**"
19+
- "agent_dev/**"
20+
- "framework.py"
21+
22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
smoke:
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 15
33+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
39+
- name: Set up Python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: "3.11"
43+
44+
- name: Install dependencies
45+
run: |
46+
pip install -e . || true
47+
pip install pytest
48+
49+
- name: Run smoke tests
50+
run: |
51+
pytest -q -k "smoke or canary"
52+
env:
53+
STILLME_DRY_RUN: "1"
54+
55+
- name: Run learning smoke only
56+
run: |
57+
pytest -q tests/test_learning_smoke.py
58+
env:
59+
STILLME_DRY_RUN: "1"
60+
61+
- name: Run framework smoke only
62+
run: |
63+
pytest -q tests/test_framework_smoke.py
64+
env:
65+
STILLME_DRY_RUN: "1"

pytest.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ markers =
2020
unit: marks tests as unit tests
2121
learning: marks tests related to learning system
2222
agentdev: marks tests related to AgentDev
23+
smoke: marks tests as smoke tests
24+
canary: marks tests as canary tests
2325

2426
# Ignore directories
2527
norecursedirs = .git .venv* __pycache__ *.egg-info dist build _attic node_modules
2628

2729
# Coverage options (if pytest-cov is installed)
2830
# addopts = --cov=stillme_core --cov=agent_dev --cov-report=html --cov-report=term
29-

tests/test_framework_smoke.py

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Framework Smoke Tests
4+
=====================
5+
6+
Basic smoke tests to verify framework imports and basic functionality work in DRY_RUN mode.
7+
These tests are designed to run quickly and provide early feedback.
8+
"""
9+
10+
import os
11+
import importlib
12+
import pytest
13+
14+
# Set DRY_RUN mode for safe imports
15+
os.environ.setdefault("STILLME_DRY_RUN", "1")
16+
17+
18+
def test_framework_smoke():
19+
"""Test that framework can be imported and has basic attributes"""
20+
framework_modules = [
21+
"framework",
22+
"stillme.framework",
23+
"stillme_core.framework"
24+
]
25+
26+
fw = None
27+
for module_name in framework_modules:
28+
try:
29+
fw = importlib.import_module(module_name)
30+
break
31+
except (ImportError, ModuleNotFoundError):
32+
continue
33+
34+
if fw is None:
35+
pytest.skip("No framework module found - skipping framework smoke test")
36+
return
37+
38+
# Test basic framework attributes
39+
assert hasattr(fw, "initialize") or hasattr(fw, "get_agentdev") or hasattr(fw, "StillMeFramework"), \
40+
f"Framework module {fw.__name__} missing expected attributes"
41+
42+
43+
def test_framework_initialization_smoke():
44+
"""Test that framework can be initialized in DRY_RUN mode"""
45+
try:
46+
from stillme_core.framework import StillMeFramework
47+
# Should be able to create instance in DRY_RUN mode
48+
fw = StillMeFramework()
49+
assert fw is not None
50+
except ImportError:
51+
pytest.skip("StillMeFramework not available")
52+
except Exception as e:
53+
# In DRY_RUN mode, API key errors are expected and acceptable
54+
error_msg = str(e).lower()
55+
if "api" in error_msg and "key" in error_msg:
56+
pytest.skip("API key required - expected in DRY_RUN mode")
57+
# Should not fail due to network calls in DRY_RUN
58+
assert "network" not in error_msg
59+
60+
61+
def test_agentdev_integration_smoke():
62+
"""Test that AgentDev can be accessed through framework"""
63+
try:
64+
from stillme_core.framework import StillMeFramework
65+
fw = StillMeFramework()
66+
67+
# Test AgentDev access
68+
agentdev = fw.get_agentdev()
69+
# AgentDev should be available (even if None in some cases)
70+
assert agentdev is not None or True # Allow None for now
71+
72+
except ImportError:
73+
pytest.skip("Framework or AgentDev not available")
74+
except Exception as e:
75+
# In DRY_RUN mode, API key errors are expected and acceptable
76+
error_msg = str(e).lower()
77+
if "api" in error_msg and "key" in error_msg:
78+
pytest.skip("API key required - expected in DRY_RUN mode")
79+
# Should not fail due to network calls in DRY_RUN
80+
assert "network" not in error_msg
81+
82+
83+
@pytest.mark.smoke
84+
def test_framework_dry_run_safe():
85+
"""Test that framework is safe in DRY_RUN mode"""
86+
# Ensure DRY_RUN is set
87+
assert os.environ.get("STILLME_DRY_RUN") == "1"
88+
89+
try:
90+
from stillme_core.framework import StillMeFramework
91+
fw = StillMeFramework()
92+
# Should not make external calls in DRY_RUN mode
93+
assert True
94+
except Exception as e:
95+
# In DRY_RUN mode, API key errors are expected and acceptable
96+
error_msg = str(e).lower()
97+
if "api" in error_msg and "key" in error_msg:
98+
pytest.skip("API key required - expected in DRY_RUN mode")
99+
# If it fails, it should be a safe failure (no network calls)
100+
assert "network" not in error_msg

tests/test_learning_smoke.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Learning System Smoke Tests
4+
===========================
5+
6+
Basic smoke tests to verify learning system imports work in DRY_RUN mode.
7+
These tests are designed to run quickly and provide early feedback.
8+
"""
9+
10+
import os
11+
import importlib
12+
import pytest
13+
14+
# Set DRY_RUN mode for safe imports
15+
os.environ.setdefault("STILLME_DRY_RUN", "1")
16+
17+
18+
def test_learning_import_smoke():
19+
"""Test that at least one learning module can be imported"""
20+
learning_modules = [
21+
"stillme_core.learning",
22+
"agent_dev.learning",
23+
"learning", # fallback
24+
"stillme.learning" # fallback
25+
]
26+
27+
imported_any = False
28+
for module_name in learning_modules:
29+
try:
30+
importlib.import_module(module_name)
31+
imported_any = True
32+
break
33+
except (ImportError, ModuleNotFoundError):
34+
continue
35+
36+
assert imported_any, f"Cannot import any learning module from: {learning_modules}"
37+
38+
39+
def test_learning_components_smoke():
40+
"""Test that learning system components can be instantiated"""
41+
try:
42+
# Test stillme_core.learning
43+
import stillme_core.learning
44+
assert hasattr(stillme_core.learning, '__file__')
45+
except ImportError:
46+
pass # Allow if not available
47+
48+
try:
49+
# Test agent_dev.learning
50+
import agent_dev.learning
51+
assert hasattr(agent_dev.learning, '__file__')
52+
except ImportError:
53+
pass # Allow if not available
54+
55+
56+
@pytest.mark.smoke
57+
def test_learning_dry_run_safe():
58+
"""Test that learning system is safe in DRY_RUN mode"""
59+
# Ensure DRY_RUN is set
60+
assert os.environ.get("STILLME_DRY_RUN") == "1"
61+
62+
# Test that we can import without making external calls
63+
try:
64+
import stillme_core.learning
65+
# Should not raise exceptions in DRY_RUN mode
66+
assert True
67+
except Exception as e:
68+
# If it fails, it should be a safe failure (no network calls)
69+
assert "network" not in str(e).lower()
70+
assert "api" not in str(e).lower()

0 commit comments

Comments
 (0)