-
Notifications
You must be signed in to change notification settings - Fork 0
Added functional tests #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -0,0 +1,264 @@ | |||
#!/usr/bin/env python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaict the tests access content via the api rather than accessing the frontend. A proper functional test (hardcoded) would visit a page like lifeitself.org/blog/xyz and then check that content is correct in various ways.
|
||
def run_comprehensive_tests(self): | ||
"""Run comprehensive test suite on discovered posts.""" | ||
print("\n" + "="*70) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this printing is mostly unnecessary. if we were using pytest or some other test suite this should be reported from the individual tests. overall this function to run all the tests as a function should be handled by the test runner.
|
||
return success | ||
|
||
def save_results(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to save results to a file.
print(f"\nDetailed results saved to: {output_dir / 'comprehensive_test_results.json'}") | ||
|
||
|
||
def main(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't need a main function. again use a test runner.
print(f"Error fetching WordPress content: {e}") | ||
return None | ||
|
||
def test_footnotes(self, original_html, wordpress_content): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems very specific. i would have tried to compare the content in some more generic way. not sure how exactly but would start with something very rough and go from there.
@rufuspollock
|
- Tests now fetch actual WordPress frontend HTML pages - Use requests.get(post['url']) to load real pages - Parse HTML with BeautifulSoup to verify content 2. Removed Unnecessary Code - No custom printing (pytest handles output) - No file saving (results managed by pytest) - No main() functions (use pytest runner) - Removed old test files with custom runners 3. Proper Pytest Format - All tests start with test_ prefix - Use standard pytest assertions - Clean, focused test functions - Pytest handles all reporting 4. More Generic Tests - Tests discover actual posts from WordPress automatically - Check patterns (HTML structure, content length) not specific values - Work with any posts, not hardcoded to specific ones
@Abeelha how do we add coderabbit? |
@rufuspollock will ask Anuar (he is the one who uses it in portalJS ) how-to in tomorrow's meeting, then we can have this helpful AI in the PRs |
UPDATE 2025-09-30:
1. Tests Access Frontend (Not API)
2. Removed Unnecessary Code
3. Proper Pytest Format
4. More Generic Tests
Functional Test Results
Test Summary
Comprehensive Tests: 86.7% success rate (13/15 tests passed)
Specific Post Test: 40.0% success rate (2/5 tests passed)
Test Case: "Second Renaissance: what's in a name?"
Issues Found
1. Footnotes Not Converted (FAILED)
Raw markdown footnote syntax appears in HTML:
Should be converted to proper HTML footnotes with superscript links.
2. Special Markdown Blocks Not Processed (FAILED)
Obsidian-style callout blocks remain unconverted:
Should be converted to HTML callout/note blocks.
3. Author Attribution Issues (PARTIAL)
4. Image File Missing (FAILED)
/wp-content/uploads/first-renaissance-to-second-renaissance-bridge.webp
Working Correctly
Test Files
Tests can be run from
etl/8-functional-tests/
:test_specific_post_migration.py
- Specific post comparisonfunctional_test_comprehensive.py
- General quality testsResults saved to
etl/8-functional-tests/output/