diff --git a/.github/actions/check-warnings/README.md b/.github/actions/check-warnings/README.md index 1b94ad9..1dc76e2 100644 --- a/.github/actions/check-warnings/README.md +++ b/.github/actions/check-warnings/README.md @@ -8,7 +8,7 @@ This GitHub Action scans HTML files for Python warnings and optionally fails the - Scans HTML files for configurable Python warnings **within code cell outputs only** - Prevents false positives by only checking warnings in `cell_output` HTML elements -- Supports multiple warning types (SyntaxWarning, DeprecationWarning, FutureWarning) +- Supports multiple warning types (all Python warning types by default: UserWarning, DeprecationWarning, PendingDeprecationWarning, SyntaxWarning, RuntimeWarning, FutureWarning, ImportWarning, UnicodeWarning, BytesWarning, ResourceWarning, EncodingWarning) - Provides detailed output about warnings found - Optionally fails the workflow when warnings are detected - **Creates GitHub issues** with detailed warning reports @@ -32,7 +32,7 @@ This GitHub Action scans HTML files for Python warnings and optionally fails the uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'true' # This will post a comment to the PR if warnings are found ``` @@ -43,7 +43,7 @@ This GitHub Action scans HTML files for Python warnings and optionally fails the uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning,UserWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'false' create-issue: 'true' issue-title: 'Python Warnings Found in Documentation Build' @@ -56,7 +56,7 @@ This GitHub Action scans HTML files for Python warnings and optionally fails the uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'false' create-issue: 'true' issue-title: 'Python Warnings Found in Documentation Build' @@ -70,7 +70,7 @@ This GitHub Action scans HTML files for Python warnings and optionally fails the uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'true' create-artifact: 'true' artifact-name: 'python-warning-report' @@ -83,7 +83,7 @@ This GitHub Action scans HTML files for Python warnings and optionally fails the uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning,UserWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'false' create-issue: 'true' issue-title: 'Python Warnings Detected in Build' @@ -92,6 +92,42 @@ This GitHub Action scans HTML files for Python warnings and optionally fails the artifact-name: 'detailed-warning-report' ``` +### Excluding Specific Warning Types + +Sometimes you may want to temporarily exclude certain warning types (e.g., when dealing with upstream warnings that take time to fix): + +```yaml +- name: Check for Python warnings excluding upstream warnings + uses: QuantEcon/meta/.github/actions/check-warnings@main + with: + html-path: './_build/html' + exclude-warning: 'UserWarning' # Exclude single warning type + fail-on-warning: 'true' +``` + +```yaml +- name: Check for Python warnings excluding multiple warning types + uses: QuantEcon/meta/.github/actions/check-warnings@main + with: + html-path: './_build/html' + exclude-warning: 'UserWarning,RuntimeWarning,ResourceWarning' # Exclude multiple warnings + fail-on-warning: 'true' +``` + +### Custom Warning Types with Exclusions + +You can combine custom warning lists with exclusions: + +```yaml +- name: Check for specific warnings but exclude problematic ones + uses: QuantEcon/meta/.github/actions/check-warnings@main + with: + html-path: './_build/html' + warnings: 'UserWarning,DeprecationWarning,RuntimeWarning,ResourceWarning' + exclude-warning: 'ResourceWarning' # Check all above except ResourceWarning + fail-on-warning: 'true' +``` + ### Using Outputs ```yaml @@ -215,7 +251,8 @@ If you're only using the basic warning check functionality, only `contents: read | Input | Description | Required | Default | |-------|-------------|----------|---------| | `html-path` | Path to directory containing HTML files to scan | No | `.` | -| `warnings` | Comma-separated list of warnings to check for | No | `SyntaxWarning,DeprecationWarning,FutureWarning` | +| `warnings` | Comma-separated list of warnings to check for | No | `UserWarning,DeprecationWarning,PendingDeprecationWarning,SyntaxWarning,RuntimeWarning,FutureWarning,ImportWarning,UnicodeWarning,BytesWarning,ResourceWarning,EncodingWarning` | +| `exclude-warning` | Comma-separated list of warnings to exclude from checking (can be a single warning or multiple warnings) | No | `` | | `fail-on-warning` | Whether to fail the workflow if warnings are found | No | `true` | | `create-issue` | Whether to create a GitHub issue when warnings are found | No | `false` | | `issue-title` | Title for the GitHub issue when warnings are found | No | `Python Warnings Found in Documentation Build` | @@ -276,7 +313,7 @@ jobs: uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: ${{ github.event_name == 'push' }} # Fail on push, warn on PR create-issue: ${{ github.event_name == 'push' }} # Create issues for main branch notify: 'maintainer1,reviewer2' # Assign issues to team members @@ -313,7 +350,12 @@ This action is particularly useful for: 3. **Customize warning types**: Adjust the `warnings` input to match your project's needs. -4. **Path considerations**: Make sure the `html-path` points to where your build process outputs HTML files. +4. **Exclude problematic warnings temporarily**: Use `exclude-warning` to temporarily exclude warnings from upstream dependencies or issues that take time to fix: + ```yaml + exclude-warning: 'UserWarning,RuntimeWarning' # Exclude multiple warnings + ``` + +5. **Path considerations**: Make sure the `html-path` points to where your build process outputs HTML files. 5. **Integration with existing workflows**: This action can be easily added to existing CI/CD pipelines. diff --git a/.github/actions/check-warnings/action.yml b/.github/actions/check-warnings/action.yml index 4b14af7..e97b4c4 100755 --- a/.github/actions/check-warnings/action.yml +++ b/.github/actions/check-warnings/action.yml @@ -10,7 +10,11 @@ inputs: warnings: description: 'Comma-separated list of warnings to check for' required: false - default: 'SyntaxWarning,DeprecationWarning,FutureWarning' + default: 'UserWarning,DeprecationWarning,PendingDeprecationWarning,SyntaxWarning,RuntimeWarning,FutureWarning,ImportWarning,UnicodeWarning,BytesWarning,ResourceWarning,EncodingWarning' + exclude-warning: + description: 'Comma-separated list of warnings to exclude from checking (can be a single warning or multiple warnings)' + required: false + default: '' fail-on-warning: description: 'Whether to fail the workflow if warnings are found' required: false @@ -63,6 +67,7 @@ runs: # Parse inputs HTML_PATH="${{ inputs.html-path }}" WARNINGS="${{ inputs.warnings }}" + EXCLUDE_WARNINGS="${{ inputs.exclude-warning }}" FAIL_ON_WARNING="${{ inputs.fail-on-warning }}" echo "Scanning HTML files in: $HTML_PATH" @@ -71,6 +76,46 @@ runs: # Convert comma-separated warnings to array IFS=',' read -ra WARNING_ARRAY <<< "$WARNINGS" + # Handle exclude-warning parameter + if [ -n "$EXCLUDE_WARNINGS" ]; then + echo "Excluding warnings: $EXCLUDE_WARNINGS" + # Convert comma-separated exclude warnings to array + IFS=',' read -ra EXCLUDE_ARRAY <<< "$EXCLUDE_WARNINGS" + + # Create a new array with warnings not in exclude list + FILTERED_WARNING_ARRAY=() + for warning in "${WARNING_ARRAY[@]}"; do + # Remove leading/trailing whitespace from warning + warning=$(echo "$warning" | xargs) + exclude_warning=false + + # Check if this warning should be excluded + for exclude in "${EXCLUDE_ARRAY[@]}"; do + # Remove leading/trailing whitespace from exclude warning + exclude=$(echo "$exclude" | xargs) + if [ "$warning" = "$exclude" ]; then + exclude_warning=true + break + fi + done + + # Add to filtered array if not excluded + if [ "$exclude_warning" = false ]; then + FILTERED_WARNING_ARRAY+=("$warning") + fi + done + + # Replace WARNING_ARRAY with filtered array + WARNING_ARRAY=("${FILTERED_WARNING_ARRAY[@]}") + + # Show final warning list + if [ ${#WARNING_ARRAY[@]} -eq 0 ]; then + echo "⚠️ All warnings have been excluded. No warnings will be checked." + else + echo "Final warning list after exclusions: ${WARNING_ARRAY[*]}" + fi + fi + # Initialize counters TOTAL_WARNINGS=0 WARNING_DETAILS="" @@ -150,6 +195,12 @@ runs: for file in "${FILES[@]}"; do echo "Checking file: $file" + # Skip warning check if no warnings to check for + if [ ${#WARNING_ARRAY[@]} -eq 0 ]; then + echo "No warnings to check for in $file (all excluded)" + continue + fi + for warning in "${WARNING_ARRAY[@]}"; do # Remove leading/trailing whitespace from warning warning=$(echo "$warning" | xargs) diff --git a/.github/actions/check-warnings/examples.md b/.github/actions/check-warnings/examples.md index d655cec..f57c1c2 100644 --- a/.github/actions/check-warnings/examples.md +++ b/.github/actions/check-warnings/examples.md @@ -39,7 +39,7 @@ jobs: uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'true' ``` @@ -158,7 +158,7 @@ jobs: uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning,UserWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'false' # Don't fail on warnings create-issue: ${{ github.event_name == 'push' }} # Create issues only on push to main issue-title: 'Python Warnings in Documentation Build - ${{ github.sha }}' @@ -267,10 +267,103 @@ jobs: uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './output' - warnings: ${{ github.event.inputs.custom_warnings || 'SyntaxWarning,DeprecationWarning,FutureWarning' }} + warnings: ${{ github.event.inputs.custom_warnings || 'UserWarning,RuntimeWarning,ResourceWarning' }} fail-on-warning: 'true' ``` +## Example 6b: Excluding Specific Warning Types + +```yaml +name: Check with Warning Exclusions + +on: + push: + branches: [ main ] + +jobs: + warning-check-with-exclusions: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build documentation + run: | + jupyter-book build . + + - name: Check for warnings excluding upstream issues + uses: QuantEcon/meta/.github/actions/check-warnings@main + with: + html-path: './_build/html' + exclude-warning: 'UserWarning' # Exclude problematic upstream warnings + fail-on-warning: 'true' +``` + +## Example 6c: Multiple Warning Exclusions + +```yaml +name: Check with Multiple Warning Exclusions + +on: + pull_request: + branches: [ main ] + +jobs: + warning-check-multiple-exclusions: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build documentation + run: | + jupyter-book build . + + - name: Check for warnings excluding multiple types + uses: QuantEcon/meta/.github/actions/check-warnings@main + with: + html-path: './_build/html' + exclude-warning: 'UserWarning,RuntimeWarning,ResourceWarning' # Exclude multiple warning types + fail-on-warning: 'true' + create-artifact: 'true' + artifact-name: 'filtered-warning-report' +``` + +## Example 6d: Custom Warnings with Exclusions + +```yaml +name: Custom Warnings with Exclusions + +on: + schedule: + - cron: '0 2 * * 1' # Weekly on Monday + +jobs: + custom-warning-check-with-exclusions: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build project + run: | + make build + + - name: Check for specific warnings but exclude problematic ones + uses: QuantEcon/meta/.github/actions/check-warnings@main + with: + html-path: './output' + warnings: 'UserWarning,DeprecationWarning,RuntimeWarning,FutureWarning,ResourceWarning' + exclude-warning: 'ResourceWarning,RuntimeWarning' # Exclude known upstream issues + fail-on-warning: 'false' + create-issue: 'true' + issue-title: 'Critical Python Warnings Found (Filtered)' + notify: 'team-lead' +``` + ## Example 7: Matrix Strategy ```yaml @@ -308,7 +401,7 @@ jobs: uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'false' - name: Upload HTML artifacts if warnings found diff --git a/.github/workflows/test-warning-check.yml b/.github/workflows/test-warning-check.yml index d6dfb6f..535c0db 100644 --- a/.github/workflows/test-warning-check.yml +++ b/.github/workflows/test-warning-check.yml @@ -88,4 +88,238 @@ jobs: echo "❌ Expected action to fail but it succeeded" exit 1 fi - echo "✅ Fail-on-warning test passed" \ No newline at end of file + echo "✅ Fail-on-warning test passed" + + test-new-warning-types: + runs-on: ubuntu-latest + name: Test new warning types (UserWarning, RuntimeWarning, etc.) + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Test action with new warning types + id: new-warning-test + uses: .//.github/actions/check-warnings + with: + html-path: './test/check-warnings/with-new-warnings.html' + fail-on-warning: 'false' + + - name: Verify new warning types are detected + run: | + echo "Warnings found: ${{ steps.new-warning-test.outputs.warnings-found }}" + echo "Warning count: ${{ steps.new-warning-test.outputs.warning-count }}" + echo "Warning details: ${{ steps.new-warning-test.outputs.warning-details }}" + if [ "${{ steps.new-warning-test.outputs.warnings-found }}" != "true" ]; then + echo "❌ Expected new warning types to be found but found none" + exit 1 + fi + if [ "${{ steps.new-warning-test.outputs.warning-count }}" -lt "5" ]; then + echo "❌ Expected at least 5 new warning types but found ${{ steps.new-warning-test.outputs.warning-count }}" + exit 1 + fi + # Check that specific new warning types are detected + if [[ "${{ steps.new-warning-test.outputs.warning-details }}" != *"UserWarning"* ]]; then + echo "❌ UserWarning not detected" + exit 1 + fi + if [[ "${{ steps.new-warning-test.outputs.warning-details }}" != *"RuntimeWarning"* ]]; then + echo "❌ RuntimeWarning not detected" + exit 1 + fi + if [[ "${{ steps.new-warning-test.outputs.warning-details }}" != *"ResourceWarning"* ]]; then + echo "❌ ResourceWarning not detected" + exit 1 + fi + echo "✅ New warning types test passed" + + test-exclude-warning-single: + runs-on: ubuntu-latest + name: Test exclude-warning with single warning type + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Test action with single warning exclusion + id: exclude-single-test + uses: .//.github/actions/check-warnings + with: + html-path: './test/check-warnings/exclude-test.html' + exclude-warning: 'UserWarning' + fail-on-warning: 'false' + + - name: Verify single exclusion results + run: | + echo "Warnings found: ${{ steps.exclude-single-test.outputs.warnings-found }}" + echo "Warning count: ${{ steps.exclude-single-test.outputs.warning-count }}" + echo "Warning details: ${{ steps.exclude-single-test.outputs.warning-details }}" + + # Should find warnings (DeprecationWarning, RuntimeWarning, ResourceWarning) but not UserWarning + if [ "${{ steps.exclude-single-test.outputs.warnings-found }}" != "true" ]; then + echo "❌ Expected warnings but found none after excluding UserWarning" + exit 1 + fi + + # Should find 3 warnings (excluding UserWarning) + if [ "${{ steps.exclude-single-test.outputs.warning-count }}" -ne "3" ]; then + echo "❌ Expected 3 warnings but found ${{ steps.exclude-single-test.outputs.warning-count }}" + exit 1 + fi + + # Should NOT contain UserWarning + if [[ "${{ steps.exclude-single-test.outputs.warning-details }}" == *"UserWarning"* ]]; then + echo "❌ UserWarning was found but should have been excluded" + exit 1 + fi + + # Should contain other warnings + if [[ "${{ steps.exclude-single-test.outputs.warning-details }}" != *"DeprecationWarning"* ]]; then + echo "❌ DeprecationWarning not found" + exit 1 + fi + + echo "✅ Single exclude-warning test passed" + + test-exclude-warning-multiple: + runs-on: ubuntu-latest + name: Test exclude-warning with multiple warning types + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Test action with multiple warning exclusions + id: exclude-multiple-test + uses: .//.github/actions/check-warnings + with: + html-path: './test/check-warnings/exclude-test.html' + exclude-warning: 'UserWarning,RuntimeWarning' + fail-on-warning: 'false' + + - name: Verify multiple exclusion results + run: | + echo "Warnings found: ${{ steps.exclude-multiple-test.outputs.warnings-found }}" + echo "Warning count: ${{ steps.exclude-multiple-test.outputs.warning-count }}" + echo "Warning details: ${{ steps.exclude-multiple-test.outputs.warning-details }}" + + # Should find warnings (DeprecationWarning, ResourceWarning) but not UserWarning or RuntimeWarning + if [ "${{ steps.exclude-multiple-test.outputs.warnings-found }}" != "true" ]; then + echo "❌ Expected warnings but found none after excluding UserWarning and RuntimeWarning" + exit 1 + fi + + # Should find 2 warnings (excluding UserWarning and RuntimeWarning) + if [ "${{ steps.exclude-multiple-test.outputs.warning-count }}" -ne "2" ]; then + echo "❌ Expected 2 warnings but found ${{ steps.exclude-multiple-test.outputs.warning-count }}" + exit 1 + fi + + # Should NOT contain excluded warnings + if [[ "${{ steps.exclude-multiple-test.outputs.warning-details }}" == *"UserWarning"* ]]; then + echo "❌ UserWarning was found but should have been excluded" + exit 1 + fi + if [[ "${{ steps.exclude-multiple-test.outputs.warning-details }}" == *"RuntimeWarning"* ]]; then + echo "❌ RuntimeWarning was found but should have been excluded" + exit 1 + fi + + # Should contain non-excluded warnings + if [[ "${{ steps.exclude-multiple-test.outputs.warning-details }}" != *"DeprecationWarning"* ]]; then + echo "❌ DeprecationWarning not found" + exit 1 + fi + if [[ "${{ steps.exclude-multiple-test.outputs.warning-details }}" != *"ResourceWarning"* ]]; then + echo "❌ ResourceWarning not found" + exit 1 + fi + + echo "✅ Multiple exclude-warning test passed" + + test-exclude-warning-all: + runs-on: ubuntu-latest + name: Test exclude-warning excluding all warnings + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Test action with all warnings excluded + id: exclude-all-test + uses: .//.github/actions/check-warnings + with: + html-path: './test/check-warnings/exclude-test.html' + exclude-warning: 'UserWarning,DeprecationWarning,RuntimeWarning,ResourceWarning' + fail-on-warning: 'false' + + - name: Verify all exclusion results + run: | + echo "Warnings found: ${{ steps.exclude-all-test.outputs.warnings-found }}" + echo "Warning count: ${{ steps.exclude-all-test.outputs.warning-count }}" + echo "Warning details: ${{ steps.exclude-all-test.outputs.warning-details }}" + + # Should find no warnings (all excluded) + if [ "${{ steps.exclude-all-test.outputs.warnings-found }}" != "false" ]; then + echo "❌ Expected no warnings but found some after excluding all" + exit 1 + fi + + if [ "${{ steps.exclude-all-test.outputs.warning-count }}" -ne "0" ]; then + echo "❌ Expected 0 warnings but found ${{ steps.exclude-all-test.outputs.warning-count }}" + exit 1 + fi + + echo "✅ All exclude-warning test passed" + + test-exclude-warning-with-custom-warnings: + runs-on: ubuntu-latest + name: Test exclude-warning with custom warning list + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Test action with custom warnings and exclusions + id: exclude-custom-test + uses: .//.github/actions/check-warnings + with: + html-path: './test/check-warnings/exclude-test.html' + warnings: 'UserWarning,DeprecationWarning,RuntimeWarning' + exclude-warning: 'RuntimeWarning' + fail-on-warning: 'false' + + - name: Verify custom warning exclusion results + run: | + echo "Warnings found: ${{ steps.exclude-custom-test.outputs.warnings-found }}" + echo "Warning count: ${{ steps.exclude-custom-test.outputs.warning-count }}" + echo "Warning details: ${{ steps.exclude-custom-test.outputs.warning-details }}" + + # Should find UserWarning and DeprecationWarning but not RuntimeWarning or ResourceWarning + if [ "${{ steps.exclude-custom-test.outputs.warnings-found }}" != "true" ]; then + echo "❌ Expected warnings but found none with custom warnings and exclusion" + exit 1 + fi + + # Should find 2 warnings (UserWarning, DeprecationWarning) + if [ "${{ steps.exclude-custom-test.outputs.warning-count }}" -ne "2" ]; then + echo "❌ Expected 2 warnings but found ${{ steps.exclude-custom-test.outputs.warning-count }}" + exit 1 + fi + + # Should NOT contain RuntimeWarning or ResourceWarning + if [[ "${{ steps.exclude-custom-test.outputs.warning-details }}" == *"RuntimeWarning"* ]]; then + echo "❌ RuntimeWarning was found but should have been excluded" + exit 1 + fi + if [[ "${{ steps.exclude-custom-test.outputs.warning-details }}" == *"ResourceWarning"* ]]; then + echo "❌ ResourceWarning was found but should not be in custom warning list" + exit 1 + fi + + # Should contain UserWarning and DeprecationWarning + if [[ "${{ steps.exclude-custom-test.outputs.warning-details }}" != *"UserWarning"* ]]; then + echo "❌ UserWarning not found" + exit 1 + fi + if [[ "${{ steps.exclude-custom-test.outputs.warning-details }}" != *"DeprecationWarning"* ]]; then + echo "❌ DeprecationWarning not found" + exit 1 + fi + + echo "✅ Custom warning exclusion test passed" \ No newline at end of file diff --git a/README.md b/README.md index e94320b..8cef683 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A GitHub Action that scans HTML files for Python warnings and optionally fails t uses: QuantEcon/meta/.github/actions/check-warnings@main with: html-path: './_build/html' - warnings: 'SyntaxWarning,DeprecationWarning,FutureWarning' + # Uses comprehensive default warnings (all Python warning types) fail-on-warning: 'true' ``` diff --git a/test/check-warnings/exclude-test.html b/test/check-warnings/exclude-test.html new file mode 100644 index 0000000..e8c150d --- /dev/null +++ b/test/check-warnings/exclude-test.html @@ -0,0 +1,33 @@ + + + + Test HTML for Exclude Warning Functionality + + +

Test Page

+ + +
+
/home/user/script.py:10: UserWarning: This is a test message
+
+ + +
+
/home/user/script.py:20: DeprecationWarning: This function is deprecated
+
+ + +
+
/home/user/script.py:30: RuntimeWarning: Invalid value encountered
+
+ + +
+
/home/user/script.py:40: ResourceWarning: unclosed file
+
+ + +

This paragraph mentions UserWarning but should not be detected.

+ + + \ No newline at end of file diff --git a/test/check-warnings/with-new-warnings.html b/test/check-warnings/with-new-warnings.html new file mode 100644 index 0000000..def3eb5 --- /dev/null +++ b/test/check-warnings/with-new-warnings.html @@ -0,0 +1,31 @@ + + + + Code Output with New Warning Types + + +

Test Output with New Warning Types

+
+
+Running code with various warnings...
+/path/to/file.py:15: UserWarning: Creating legend with loc="best" can be slow with large amounts of data.
+  fig.canvas.print_figure(bytes_io, **kw)
+/path/to/file.py:25: RuntimeWarning: divide by zero encountered in log
+  result = np.log(0)
+/path/to/file.py:35: ResourceWarning: unclosed file <_io.TextIOWrapper name='test.txt' mode='r' encoding='UTF-8'>
+  f = open('test.txt')
+Result: computed successfully
+        
+
+
+
+Another execution with more warnings...
+/path/to/another.py:10: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
+  import local_module
+/path/to/another.py:20: BytesWarning: str() on a bytes instance
+  text = str(b'hello')
+Done!
+        
+
+ + \ No newline at end of file