Skip to content

Properly isolated selftests - #6338

Open
pevogam wants to merge 7 commits into
avocado-framework:masterfrom
pevogam:properly-isolated-selftests
Open

Properly isolated selftests#6338
pevogam wants to merge 7 commits into
avocado-framework:masterfrom
pevogam:properly-isolated-selftests

Conversation

@pevogam

@pevogam pevogam commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added support for disabling selected plugins and entry points by fully qualified name.
    • Added --max-parallel-tasks to limit concurrent test execution while preserving serial test suites.
  • Bug Fixes

    • Disabled plugins are excluded before loading.
    • Missing plugin configuration safely defaults to no disabled plugins.
    • Improved handling of failed commands and optional PyYAML availability.
    • Self-tests are isolated from host-installed packages and external configuration.
  • Tests

    • Updated plugin variant handling and expanded coverage for disabled plugins and parallel execution.

@mr-avocado mr-avocado Bot moved this to Review Requested in Default project Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d07540dc-f4cb-4ebb-80b7-acde9fc928bf

📥 Commits

Reviewing files that changed from the base of the PR and between 79fdd53 and e462c56.

📒 Files selected for processing (1)
  • selftests/check.py

Walkthrough

The change adds pre-import filtering for disabled plugins and separates fully qualified name handling for extensions and entry points. The self-test runner now isolates source-tree execution, supports bounded parallelism, normalizes repeated selection options, and excludes unavailable or disabled optional plugins. Functional tests now support missing PyYAML, failed man-page commands, and JSON variant fixtures. A dispatcher test verifies that disabled plugins are not loaded.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: isolating selftests from external paths, configuration, and plugins.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@selftests/check.py`:
- Around line 17-23: Add the Ansible plugin mapping to OPTIONAL_PLUGINS using
the key “ansible” and package “avocado-framework-plugin-ansible”, so
_external_plugins() preserves the Ansible entry points required by the
nrunner-interface avocado-runner-ansible-module variant.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f89d75a2-c9ae-4f80-ac6e-7e801a79a5a1

📥 Commits

Reviewing files that changed from the base of the PR and between a02d1ea and 16df151.

📒 Files selected for processing (8)
  • avocado/core/enabled_extension_manager.py
  • avocado/core/extension_manager.py
  • selftests/check.py
  • selftests/functional/basic.py
  • selftests/functional/plugin/jsonresult.py
  • selftests/functional/plugin/tmtresult.py
  • selftests/functional/plugin/xunit.py
  • selftests/unit/dispatcher.py

Comment thread selftests/check.py
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.39%. Comparing base (a02d1ea) to head (e462c56).

Files with missing lines Patch % Lines
avocado/core/extension_manager.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6338      +/-   ##
==========================================
- Coverage   71.74%   71.39%   -0.36%     
==========================================
  Files         207      207              
  Lines       23624    23637      +13     
==========================================
- Hits        16949    16875      -74     
- Misses       6675     6762      +87     

☔ 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.

pevogam added 3 commits August 8, 2026 02:02
Allow callers to cap parallel tasks while preserving suites that
require serial execution.

Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
Assert the TestInterrupt message emitted by the current runner
instead of the obsolete SIGTERM RuntimeError text.

Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
Avoid loading disabled plugin modules so missing optional dependencies
and import side effects cannot pollute unrelated commands as well as
the avocado (isolation) selftests.

This is done with a separate enabled entry point switch than the
one used for extensions (generalized now and default).

Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
@pevogam
pevogam force-pushed the properly-isolated-selftests branch from 16df151 to dccde94 Compare August 7, 2026 18:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@selftests/check.py`:
- Around line 938-964: Update create_suites() so optional-plugin test references
are added only when the corresponding plugin distribution is available and not
listed in args.disable_plugin_checks, matching the TEST_SIZE adjustments for
golang, html, robot, varianter_cit, and varianter_yaml_to_mux. Alternatively,
derive TEST_SIZE from the references actually selected, while preserving
consistent suite counts.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 810d5f9d-12cc-4ac3-854d-a77212b19775

📥 Commits

Reviewing files that changed from the base of the PR and between 16df151 and dccde94.

📒 Files selected for processing (1)
  • selftests/check.py

Comment thread selftests/check.py Outdated
@pevogam
pevogam force-pushed the properly-isolated-selftests branch from dccde94 to 79fdd53 Compare August 8, 2026 07:54
pevogam added 4 commits August 8, 2026 17:14
Use checkout-local plugin paths and temporary configuration while
excluding unrelated installations. Honor any plugin exclusions
consistently and only test runner commands that exist.

The main way to achieve proper test isolation here is by changing
the system python paths and placing any avocado configs for the
selftests in a temporary directory.

Selftest-related plugins are allowed separately while test counts
are kept consistent across the check script.

Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
This is a better choice for testing the same functionality than
the explicit sometimes disabled varianter_yaml_to_mux plugin
which may not be available in all environments.

Also improve command failure in the tests instead of a misleading
"missing file" error if the command fails to make them faster to
debug.

Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
Treat an unavailable manual page as an inconclusive outcome instead
of failing module import.

Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
@pevogam
pevogam force-pushed the properly-isolated-selftests branch from 79fdd53 to e462c56 Compare August 8, 2026 09:19
@pevogam
pevogam requested a review from PraveenPenguin August 8, 2026 09:59
@pevogam

pevogam commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

@PraveenPenguin This branch mostly improves the test isolation of the avocado selftests so we can also run them in other environments outside of the CI (e.g. LXC or other containers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Review Requested

Development

Successfully merging this pull request may close these issues.

1 participant