Skip to content

[CI] Add pre-commit hook name-tests-test to verify that Python test… - #14716

Draft
jbampton wants to merge 1 commit into
apache:mainfrom
jbampton:name-tests-python
Draft

jbampton wants to merge 1 commit into
apache:mainfrom
jbampton:name-tests-python

Conversation

@jbampton

Copy link
Copy Markdown
Member

… files are named correctly

https://github.com/pre-commit/pre-commit-hooks#name-tests-test

Description

This PR adds another basic check or test to ensure our Python test files are all standardised and namely correctly.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

prek run -a

How did you try to break this feature and the system with this change?

Copilot AI balanced review requested due to automatic review settings November 16, 2026 20:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The hook’s default file filter skips the main test suites, leaving nonconforming test names unchecked even with --all-files and failing to enforce the intended naming standard.

1 open issue
What changed in this PR

Adds a Python test-filename check to CloudStack’s existing pre-commit checks to help standardize test naming.

Changes:

  • Enables the upstream name-tests-test hook.
  • Sets --pytest-test-first to require test_*.py filenames for files selected by the hook.
File Description
.pre-commit-config.yaml Adds and configures the Python test-naming hook.

Review effort: Balanced

Comment thread .pre-commit-config.yaml
Comment on lines +185 to +186
- id: name-tests-test
args: [--pytest-test-first]
@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.86%. Comparing base (278bde2) to head (27bd9f0).

❗ There is a different number of reports uploaded between BASE (278bde2) and HEAD (27bd9f0). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (278bde2) HEAD (27bd9f0)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #14716       +/-   ##
=============================================
- Coverage     20.78%    3.86%   -16.92%     
=============================================
  Files          6053      494     -5559     
  Lines        548230    42875   -505355     
  Branches      73237     8136    -65101     
=============================================
- Hits         113928     1657   -112271     
+ Misses       420955    40986   -379969     
+ Partials      13347      232    -13115     
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jbampton
jbampton marked this pull request as draft November 16, 2026 20:36

This branch has not been deployed

No deployments
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