Skip to content

[Issue]: [pr-bot]: Unit Test policy check fails on existing capitalized test files (e.g., Test*.cpp) #9010

Description

@MarijaGijic

Problem Description

The Libraries PR Bot fails the 🧪 Unit Test policy check on PRs that modify existing test suites if those test files use a capitalized naming convention (e.g., Test*.cpp).

Currently, the bot strictly expects test files to match test_* or *_test.*. Because the repository contains legacy or standard test files named with an uppercase T (such as TestBatchnormAttributes.cpp), any modifications to these files are ignored by the bot's scanner. This forces developers to introduce dummy files or rename valid files just to pass the gate.

Expected Behavior

The bot should recognize common variations of test file naming conventions present in the repository, specifically supporting case-insensitive matching or explicitly adding the Test*.cpp / Test*.hpp patterns.

How to Reproduce

  1. Modify a source file (e.g., Attributes.hpp).
  2. Modify or expand an existing test file named with a capital T (e.g., TestBatchnormAttributes.cpp).
  3. Push the branch and observe the bot output:

Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_.py / test_.cpp (or _test.*).

Suggested Fix

Update the regular expression or wildcard matching pattern in the bot's configuration (e.g., policy.yml or the underlying python script) to include case-insensitive matching or add the uppercase pattern:

# Conceptual fix for the policy pattern
test_file_patterns:
  - "test_*"
  - "*_test.*"
  - "Test_*"
  - "Test*" # To catch TestBatchnormAttributes.cpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions