Skip to content

Include the TasksPlugin in the TasksApplication tests - #621

Merged
mdickinson merged 2 commits into
mainfrom
fix/615-tasks-plugin-in-tests
Aug 5, 2026
Merged

mdickinson merged 2 commits into
mainfrom
fix/615-tasks-plugin-in-tests

Conversation

@mdickinson

Copy link
Copy Markdown
Member

Closes #615. This removes the last four WARNING-level log records from
the test suite — the ones #618 deliberately deferred.

The behaviour is fine; the tests were misconfigured

#618 predicted this was "a wart to fix rather than noise to silence",
on the grounds that any application subclassing TasksApplication
without TasksPlugin warns at startup. Investigating that under #620
turned up the opposite conclusion: TasksApplication needs
TasksPlugin, so an application without it is misconfigured, and the
warning is doing its job.

The registration path, for the record:

  1. Application.extension_registry defaults to
    PluginExtensionRegistry(plugin_manager=self).
  2. Each plugin is added as a provider;
    ProviderExtensionRegistry._add_provider_extension_points
    (provider_extension_registry.py:159) stores whatever
    provider.get_extension_points() returns.
  3. Plugin.get_extension_points (plugin.py:107) returns the trait
    type of every trait marked __extension_point__=True.
  4. TasksPlugin.tasks (tasks_plugin.py:88) carries
    id = "envisage.ui.tasks.tasks", which is exactly
    TasksApplication.TASK_FACTORIES (tasks_application.py:48). Same
    for task_extensions.

What makes the dependency easy to miss is that the two sides share no
name — the consumer trait is task_factories, the provider trait is
tasks. Only the id string ties them together.

That the plugin is required is not a novel claim:

  • run_attractor.py:23, the only complete Tasks example in the tree,
    builds [CorePlugin(), TasksPlugin(), AttractorsPlugin()], and
    AttractorsPlugin is a pure contributor — tasks = List(contributes_to="envisage.ui.tasks.tasks") — relying on
    TasksPlugin to have declared the point.
  • docs/source/tasks_user_manual/extensibility.rst:22 has a section
    headed "The Tasks Plugin" describing it as the owner of those
    extension points.

So the pattern of declaring a read-only ExtensionPoint trait on a
consumer is not penalised by the warning: it is silent whenever the
companion plugin is present, which supported usage ensures. Verified
both ways — with TasksPlugin in the plugin list, no warning and no
ordering hazard; without it, the warning.

The change

The four noisy tests built a bare TasksApplication with no plugins,
_default_layout_default read self.task_factories, and the registry
warned. All seven constructions in the file now go through a
create_tasks_application helper that supplies TasksPlugin.

A helper rather than seven copies of plugins=[TasksPlugin()], so the
invariant is stated once in the place that explains why — otherwise it
reads as incidental boilerplate that could be stripped out, bringing
the noise back. Applied to all seven sites, not just the four noisy
ones, so tests added later inherit it.

test_lifecycle_with_plugin asserts an exact event sequence; that is
undisturbed, as TasksPlugin fires no lifecycle events of its own.

Not changed

ProviderExtensionRegistry._get_extensions keeps the warning, so the
test-side coupling #618 introduced stays correct and needs no edit:
both test_get_extensions_of_unknown_extension_point and the setUp
logger suppression in test_provider_extension_registry.py remain
valid. That suppression is not dead code under this resolution.

The API asymmetry #618 also flagged — ExtensionRegistry.get_extensions
silent on an unknown id, ProviderExtensionRegistry's warning,
set_extensions and remove_extension_point raising
UnknownExtensionPoint — is untouched and still deserves its own
discussion.

Verification

The seven tests in this file are @requires_gui, so they skip silently
without a toolkit installed; runs below inject PySide6.

🤖 Generated with Claude Code

Closes #615. This removes the last four WARNING-level log records from
the test suite — the ones #618 deliberately deferred.

## The behaviour is fine; the tests were misconfigured

#618 predicted this was "a wart to fix rather than noise to silence",
on the grounds that any application subclassing `TasksApplication`
without `TasksPlugin` warns at startup. Investigating that under #620
turned up the opposite conclusion: `TasksApplication` needs
`TasksPlugin`, so an application without it is misconfigured, and the
warning is doing its job.

The registration path, for the record:

1. `Application.extension_registry` defaults to
   `PluginExtensionRegistry(plugin_manager=self)`.
2. Each plugin is added as a provider;
   `ProviderExtensionRegistry._add_provider_extension_points`
   (`provider_extension_registry.py:159`) stores whatever
   `provider.get_extension_points()` returns.
3. `Plugin.get_extension_points` (`plugin.py:107`) returns the trait
   *type* of every trait marked `__extension_point__=True`.
4. `TasksPlugin.tasks` (`tasks_plugin.py:88`) carries
   `id = "envisage.ui.tasks.tasks"`, which is exactly
   `TasksApplication.TASK_FACTORIES` (`tasks_application.py:48`). Same
   for `task_extensions`.

What makes the dependency easy to miss is that the two sides share no
*name* — the consumer trait is `task_factories`, the provider trait is
`tasks`. Only the id string ties them together.

That the plugin is required is not a novel claim:

* `run_attractor.py:23`, the only complete Tasks example in the tree,
  builds `[CorePlugin(), TasksPlugin(), AttractorsPlugin()]`, and
  `AttractorsPlugin` is a pure contributor — `tasks =
  List(contributes_to="envisage.ui.tasks.tasks")` — relying on
  `TasksPlugin` to have declared the point.
* `docs/source/tasks_user_manual/extensibility.rst:22` has a section
  headed "The Tasks Plugin" describing it as the owner of those
  extension points.

So the pattern of declaring a read-only `ExtensionPoint` trait on a
consumer is not penalised by the warning: it is silent whenever the
companion plugin is present, which supported usage ensures. Verified
both ways — with `TasksPlugin` in the plugin list, no warning and no
ordering hazard; without it, the warning.

## The change

The four noisy tests built a bare `TasksApplication` with no plugins,
`_default_layout_default` read `self.task_factories`, and the registry
warned. All seven constructions in the file now go through a
`create_tasks_application` helper that supplies `TasksPlugin`.

A helper rather than seven copies of `plugins=[TasksPlugin()]`, so the
invariant is stated once in the place that explains why — otherwise it
reads as incidental boilerplate that could be stripped out, bringing
the noise back. Applied to all seven sites, not just the four noisy
ones, so tests added later inherit it.

`test_lifecycle_with_plugin` asserts an exact event sequence; that is
undisturbed, as `TasksPlugin` fires no lifecycle events of its own.

## Not changed

`ProviderExtensionRegistry._get_extensions` keeps the warning, so the
test-side coupling #618 introduced stays correct and needs no edit:
both `test_get_extensions_of_unknown_extension_point` and the `setUp`
logger suppression in `test_provider_extension_registry.py` remain
valid. That suppression is not dead code under this resolution.

The API asymmetry #618 also flagged — `ExtensionRegistry.get_extensions`
silent on an unknown id, `ProviderExtensionRegistry`'s warning,
`set_extensions` and `remove_extension_point` raising
`UnknownExtensionPoint` — is untouched and still deserves its own
discussion.

## Verification

The seven tests in this file are `@requires_gui`, so they skip silently
without a toolkit installed; runs below inject PySide6.

* Before: exactly the four tests named in #620 emitted `getting
  extensions of unknown extension point <envisage.ui.tasks.tasks>`.
* After: zero occurrences anywhere in the suite under
  `--log-cli-level=WARNING`; 178 passed, none skipped, no warnings.
* `black --check`, `isort --check` and `flake8` clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The argument is a list of Plugin objects to iterate over, so a list is
the natural type for its default. The default is never mutated — the
helper always builds a fresh list.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

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.

Pull request overview

Updates the TasksApplication GUI tests to construct applications with TasksPlugin included, aligning the tests with the intended runtime configuration and eliminating warning-level log noise caused by unregistered extension points.

Changes:

  • Add a create_tasks_application test helper that always includes TasksPlugin.
  • Update all TasksApplication(...) constructions in the test module to use the helper.
  • Document the test-suite change in CHANGES.rst.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
envisage/ui/tasks/tests/test_tasks_application.py Introduces a helper to include TasksPlugin and updates tests to use it.
CHANGES.rst Adds a changelog entry describing the test configuration fix and warning elimination.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mdickinson
mdickinson merged commit 95075a1 into main Aug 5, 2026
20 checks passed
@mdickinson
mdickinson deleted the fix/615-tasks-plugin-in-tests branch August 5, 2026 13:39
mdickinson added a commit that referenced this pull request Aug 5, 2026
A review of the 8.0.0 changelog against `7.0.4..main`. 7.0.4 was tagged
directly on main — `0c02d0b` is both the tag commit and the merge-base —
so
that range is exact. It holds 30 non-merge commits: 11 touching the
library or
packaging, 19 CI and infrastructure.

## The library side was already complete

All eight substantive changes had entries, and both deprecations 7.0.0
promised
to remove in 8.0 (#540, #544) are removed and listed. No
`DeprecationWarning`
remains anywhere in the library, so nothing is left dangling for 9.0.

## References now point at PRs, not issues

The two `Fixes` entries for the `HTTPError` leak cited #615, whose title
is
"Clean up test noise from warnings and WARNING-level log messages". The
leak was
found *via* that cleanup, but a reader following the reference lands on
a
test-hygiene issue rather than a resource-leak fix.

Rather than fix those two in isolation, every reference in the section
now
points at the PR that made the change: #574→#613, #616→#622, #548→#599,
#547→#612, #614→#617, and #615→#618/#619/#621 as appropriate. This also
supplies
the reference the `pkg_resources` entry was missing — #600, the PR,
rather than
#515, the issue.

Two notes:

- The "no longer writes `WARNING`-level log messages" entry cites
**both** #618
and #621. #618 deliberately deferred the four `envisage.ui.tasks.tasks`
records from the `TasksApplication` tests to a follow-up, so the claim
only
  became true once #621 landed.
- Sections for 7.0.4 and earlier are untouched; they already cite PRs.

## CI and build work added

Nineteen PRs had no entry at all, in contrast with 7.0.4, which listed
its
action bumps and copyright-header updates under `Build`. Five new
entries cover
them, aggregated where the work was one theme:

| Entry | PRs |
| --- | --- |
| Trusted publishing (OIDC) and SHA-pinned actions | #604, #608 |
| Copyright end years, and the year-rollover fix to the style check |
#596, #597, #607 |
| GitHub Action bumps | #591, #592, #593, #594, #595, #602, #603, #605,
#606, #609, #610 |
| Pre-release Pythons in the CI matrix | #601, #624 |
| `AGENTS.md` | #598, #626 |

Trusted publishing changes how releases are authenticated, so it seemed
worth
naming rather than folding into the general CI churn.

## Judgment calls worth a second opinion

**The CI matrix entry names no versions.** It reads "now includes
pre-release
Python versions" rather than "3.14, and 3.15 pre-releases". Naming them
is more
informative, but in a section whose `Removals` entry deliberately gives
no
upper bound on supported Pythons, a `Build` line ending in "3.15"
invites
exactly the reading that bound was left out to avoid. Easy to change if
you'd
rather have the numbers.

**No upper bound on Python versions.** Considered and rejected: it means
churn
on every Python release, and forwards compatibility is the reasonable
default
expectation for a package that runs warning-free on the current version.

**Deliberate omissions.** #626's other cleanups — an `IServiceRegistry`
docstring, the legacy examples README, dead Traits<6.0 test code —
change
nothing for users. There's no `Documentation` section because the doc
edits in
#599 are just the egg-manager material going away with the classes,
already
covered by the `Removals` entry. And `CorePlugin` gaining its own
`stop()` to
unregister service offers is an implementation move; the #617 entry
already
notes that `PluginActivator` no longer calls
`register_services`/`unregister_services`, which is the part a
downstream
`Plugin` subclass would notice.

## Left to the release PR

The `Released:` date line, an introductory paragraph, a "Thanks to:"
list, and
the `version = '7.0.4'` still in `pyproject.toml`. The date isn't
settled yet.

## Verification

`CHANGES.rst` parses under docutils with no warnings at report level 2
or above,
and all lines stay within 79 characters. Changelog only — no code
touched.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Clean up test noise from warnings and WARNING-level log messages

2 participants