Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Summary

Refactored test_awi_prompt_gen.py from custom test runner to standard pytest conventions, removing incompatible patterns that prevented pytest discovery and execution.

ATOM Tag

ATOM: ATOM-REFACTOR-20260119-001-pytest-compatible-tests

Why

The test class used custom __init__, run_all(), and test() methods that pytest cannot recognize. Pytest expects standard test classes without custom __init__ and standard assert statements instead of custom assertion methods.

What changed

Before:

class TestAwiPromptGen:
    def __init__(self):
        self.passed = 0
        self.failed = 0
    
    def test(self, name: str, condition: bool, error_msg: str = ""):
        if condition:
            print(f"  ✅ PASS: {name}")
            self.passed += 1
        else:
            print(f"  ❌ FAIL: {name}")
            self.failed += 1
    
    def run_all(self):
        # Custom test orchestration

After:

class TestAwiPromptGen:
    def test_scaffolder_refiner_integration(self):
        gen = AwiPromptGen()
        result = gen(user_intent="...", history=[...])
        
        assert isinstance(result, Prediction), f"Expected Prediction, got {type(result)}"
        assert len(result.content) > 0, "Content should not be empty"

Changes

  • Removed custom test infrastructure (__init__, run_all(), test() method)
  • Converted all 7 test methods to use standard assert statements
  • Added if __name__ == "__main__" block for standalone execution via pytest
  • Cleaned up line continuations to follow PEP 8
  • Moved pytest import to module level for clarity

Verification / Testing

  • All 7 tests pass with pytest experiments/test_awi_prompt_gen.py -v
  • Standalone execution works: python experiments/test_awi_prompt_gen.py
  • Tests discovered and executed by pytest's test discovery
  • Code review feedback addressed

Claude Interaction

You can interact with Claude in this PR by:

  • @mentioning Claude in comments for questions or reviews
  • Adding labels: claude:review, claude:help, claude:analyze
  • Requesting reviews: Claude will provide automated feedback
  • Ask questions: Claude can explain code, suggest improvements, or identify issues

Example commands:

  • @claude please review this PR for ATOM compliance
  • @claude explain the changes in scripts/atom-track.sh
  • @claude check for security issues
  • @claude suggest improvements

Notes

  • Tests remain organized in TestAwiPromptGen class for structure
  • All original test logic preserved, only execution mechanism changed
  • Compatible with existing pytest configuration in requirements-dev.txt

Checklist

  • ATOM tag created and referenced
  • Tests passing
  • Documentation updated (inline comments clarifying assertions)
  • No secrets committed
  • Follows existing patterns (matches other test files in repo)
  • Ready for Claude review

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Contributor

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
h.and.s Ready Ready Preview, Comment Jan 19, 2026 4:24pm

Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
…sertion

Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on prompt toolkit collaboration [experiments] Refactor test_awi_prompt_gen.py to be pytest-compatible Jan 19, 2026
Copilot AI requested a review from toolate28 January 19, 2026 16:03
…ot/sub-pr-156-again

Signed-off-by: toolated <toolated@pm.me>
@toolate28 toolate28 marked this pull request as ready for review January 19, 2026 16:25
Copilot AI review requested due to automatic review settings January 19, 2026 16:25
@github-actions
Copy link

🌀 Agent Review - Coherence Analysis

🚨 Critical - Wave function collapse imminent

Overall Coherence: NaN%


📊 Detailed Metrics

Metric Value Gauge
🔄 Curl (Coherence) 5.1% █░░░░░░░░░ 5.1%
📐 Divergence (Incompleteness) NaN% NaN%
🎲 Entropy (Info Density) 54.8% █████░░░░░ 54.8%

📈 Analysis Summary

  • Files Analyzed: 189
  • Excellent (>80%): 0 files
  • Needs Attention (<50%): 2 files

🔬 Ethical Quantum Simulation Status

⚠️ Needs Review - Coherence below threshold (<60%)

  • Wave function integrity: ⚠️
  • Decoherence detected: ⚠️
  • Review recommended before merge
⚠️ Files Needing Attention (2)
  • ./docs/specs/lambda_zero.md
  • ./docs/TROUBLESHOOTING_MCP.md

🎯 Merge Status

Review required - Coherence below threshold.

Please address coherence issues before merging.


🤖 Generated by SpiralSafe Coherence Gauge v2.0 | Powered by Quantum Topology

@toolate28 toolate28 merged commit a757fc0 into copilot/refine-prompt-toolkit-collaboration Jan 19, 2026
14 of 16 checks passed
@toolate28 toolate28 deleted the copilot/sub-pr-156-again branch January 19, 2026 16:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR successfully refactors the test file from a custom test runner to standard pytest conventions, making it discoverable and executable by pytest's test discovery mechanism.

Changes:

  • Removed custom test infrastructure (__init__, run_all(), and custom test() method) incompatible with pytest
  • Converted all 7 test methods to use standard assert statements with descriptive error messages
  • Added if __name__ == "__main__" block for standalone execution via pytest.main()

Comment on lines +44 to 46
assert ("AWI" in result.content or "intent" in result.content.lower()), (
"Content should contain AWI-related text"
)
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The outer parentheses around these assert conditions are unnecessary. In pytest, multi-line assertions can be written without wrapping the entire condition in parentheses. For cleaner code, consider using implicit line continuation within the assertion or only adding parentheses where Python requires them for line continuation. For example, this could be written as:

assert "AWI" in result.content or "intent" in result.content.lower(), \
    "Content should contain AWI-related text"

This applies to similar assertions throughout the file (lines 44-46, 58-60, 61-63, 113-115, 149-151, 152-154, 165-167, 172-174).

Copilot uses AI. Check for mistakes.
@toolate28 toolate28 changed the title [experiments] Refactor test_awi_prompt_gen.py to be pytest-compatible ATOM-REFACTOR-20260119-001-pytest-compatible-tests Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants