Skip to content

Commit

Permalink
happy mypy and pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaqq committed Sep 20, 2024
1 parent 108e3a5 commit 95a950d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions tests/integration/commands/test_analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,18 +389,21 @@ def zip_directory(directory_path: Path, zip_path: Path):


@pytest.fixture
def ops_main_linter_charms(request):
def linter_charms(request):
return request.config.rootpath / "tests/integration/ops-main-linter-charms"


@pytest.mark.parametrize(("charm", "rv"), [("smoke", 0), ("negative", 2)])
def test_ops_main_linter(
tmp_path: Path, ops_main_linter_charms: Path, emitter, config, charm: str, rv: int
tmp_path: Path, linter_charms: Path, emitter, config, charm: str, rv: int
):
zip_directory(ops_main_linter_charms / charm, (charm := tmp_path / "this.charm"))
zip_directory(linter_charms / charm, (charm_path := tmp_path / "this.charm"))

retcode = Analyse(config=config).run(
Namespace(filepath=charm, force=None, format=None, ignore=None)
Namespace(filepath=charm_path, force=None, format=None, ignore=None)
)

assert retcode == rv

if rv:
assert "ops.main() call missing" in str(emitter.interactions)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2024 Canonical Ltd.
import ops
import ops # type: ignore


class SomeCharm(ops.CharmBase): ...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2024 Canonical Ltd.
import ops
import ops # type: ignore


class SomeCharm(ops.CharmBase): ...
Expand Down

0 comments on commit 95a950d

Please sign in to comment.