Skip to content

Conversation

@james-garner-canonical
Copy link
Contributor

@james-garner-canonical james-garner-canonical commented Dec 17, 2025

This PR adds a noqa directive to the test newly added in #2219, which is needed due to the linting updates in #2228.

Copy link
Contributor

@dwilding dwilding left a comment

Choose a reason for hiding this comment

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

https://docs.astral.sh/ruff/rules/useless-expression/#known-problems suggests doing:

with pytest.warns(DeprecationWarning):
    _ = ctx.charm_spec

if I understand correctly. What do you think?

ctx = Context(CharmBase, meta={'name': 'some-name'})
with pytest.warns(DeprecationWarning):
ctx.charm_spec # type: ignore
ctx.charm_spec # type: ignore # noqa: B018
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call @dwilding

Suggested change
ctx.charm_spec # type: ignore # noqa: B018
_ = ctx.charm_spec # type: ignore

@james-garner-canonical james-garner-canonical changed the title test: update new scenario test with required noqa test: update new scenario test to fix linting error Dec 18, 2025
@james-garner-canonical james-garner-canonical merged commit 7a656f8 into canonical:main Dec 18, 2025
56 of 57 checks passed
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.

3 participants