Skip to content

test: increase coverage for convert.py to 95% with edge case tests#2880

Merged
sydseter merged 5 commits intoOWASP:masterfrom
theanand108:edge-tests-clean
Apr 25, 2026
Merged

test: increase coverage for convert.py to 95% with edge case tests#2880
sydseter merged 5 commits intoOWASP:masterfrom
theanand108:edge-tests-clean

Conversation

@theanand108
Copy link
Copy Markdown
Contributor

Summary

This PR improves test coverage for convert.py to meet the required 95% threshold by adding targeted edge-case tests and covering previously untested execution paths.

Changes

  • Added tests for PDF conversion flows (LibreOffice success/failure and docx2pdf fallback)
  • Covered YAML parsing error scenarios
  • Improved coverage for template resolution logic
  • Added tests for mapping and replacement edge cases
  • Covered error handling paths (e.g., invalid inputs, missing files)

Result

  • convert.py coverage increased to ≥95%
  • All tests pass locally
  • No linting issues introduced

AI Disclosure

Some test scaffolding and edge-case ideas were assisted by AI tools, but all logic, validation, and debugging were reviewed and verified manually.

Affirmation

I confirm that I have followed the OWASP contribution guidelines and tested all changes locally.

Next Steps

Continue improving coverage for remaining modules (e.g., capec_map_enricher.py) to further strengthen test reliability.

@sydseter
Copy link
Copy Markdown
Collaborator

@theanand108 you need to format the files.

@theanand108
Copy link
Copy Markdown
Contributor Author

Thanks for pointing that out. I’ve applied black formatting and pushed the changes. Please take another look.

@sydseter
Copy link
Copy Markdown
Collaborator

@theanand108 Fantastic. Very nice.

@sydseter sydseter merged commit 8004ea4 into OWASP:master Apr 25, 2026
12 checks passed
@theanand108
Copy link
Copy Markdown
Contributor Author

Thanks, Johan. Glad to help! I’ll continue working on improving coverage further.

@theanand108 theanand108 deleted the edge-tests-clean branch April 25, 2026 15:24
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