From 9216ab6db5489602504430b089562749fb2879e9 Mon Sep 17 00:00:00 2001 From: Bernhard Kaindl Date: Tue, 30 Jan 2024 18:23:55 +0000 Subject: [PATCH] Remove hfx_filename and perfmon from expected_to_fail --- .github/workflows/main.yml | 68 +++++++++++++++++++++++++++++ ocaml/xenopsd/scripts/swtpm-wrapper | 2 +- pyproject.toml | 19 +++++--- scripts/hfx_filename | 1 + 4 files changed, 84 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 55d9f0abd7a..3a03ded19f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -194,3 +194,71 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-review level: error + + # uses: tsuyoshicho/action-mypy@v3.13.0 + - uses: bernhardkaindl/action-mypy@36cb3a857d01c1bdaa2811893106c71580132d71 + env: + MYPYPATH: scripts/examples/python:scripts/examples:scripts/plugins:scripts:. + with: + filter_mode: nofilter + setup_method: install + setup_command: pip install mypy mock + mypy_flags: | + --scripts-are-modules + --check-untyped-defs + --allow-redefinition + --hide-error-context + --ignore-missing-imports + --no-pretty + --warn-unreachable + --disable-error-code attr-defined + --disable-error-code call-overload + --disable-error-code import-not-found + --disable-error-code import-untyped + --disable-error-code type-arg + --disable-error-code var-annotated + --exclude ocaml/events/event_listen.py + --exclude ocaml/idl + --exclude ocaml/message-switch + --exclude ocaml/tests/tests/looper.py + --exclude ocaml/xcp-rrdd/scripts/rrdd/rrdd.py + --exclude scripts/examples + --exclude scripts/examples/python/monitor-unwanted-domains.py + --exclude scripts/scalability-tests/ping-master.py + --exclude scripts/backup-sr-metadata.py + --exclude scripts/restore-sr-metadata.py + --exclude scripts/nbd_client_manager.py + target: | + scripts/perfmon + scripts/hfx_filename + scripts/mail-alarm + scripts/host-display + github_token: ${{ secrets.github_token }} + reporter: github-pr-review + + - uses: dciborow/action-pylint@0.1.1 + with: + filter_mode: nofilter + glob_pattern: scripts/examples/python/XenAPIPlugin.py + pylint_args: | + --verbose + --disable bad-indentation + --disable consider-using-dict-comprehension + --disable consider-using-f-string + --disable consider-using-with + --disable import-error + --disable import-outside-toplevel + --disable invalid-name + --disable missing-final-newline + --disable missing-class-docstring + --disable missing-function-docstring + --disable multiple-imports + --disable redefined-outer-name + --disable trailing-whitespace + --max-line-length 112 + scripts/perfmon + scripts/hfx_filename + scripts/test_perfmon.py + scripts/test_hfx_filename.py + github_token: ${{ secrets.github_token }} + reporter: github-pr-review diff --git a/ocaml/xenopsd/scripts/swtpm-wrapper b/ocaml/xenopsd/scripts/swtpm-wrapper index dfb322e6453..67d4ec7ebf3 100755 --- a/ocaml/xenopsd/scripts/swtpm-wrapper +++ b/ocaml/xenopsd/scripts/swtpm-wrapper @@ -87,7 +87,7 @@ def check_state_needs_init(fname): return False # Check if block device has non-zero header - with open(fname, "r") as file: + with open(fname, "rb") as file: hdr = file.read(8) int_hdr = struct.unpack(" and maybe a few other minor updates: "scripts/hatests", "scripts/backup-sr-metadata.py", @@ -112,13 +122,12 @@ inputs = [ "scripts/xe-scsi-dev-map", "scripts/examples/python", "scripts/yum-plugins", - "scripts/*.py", - # To be added later, # when converted to Python3-compatible syntax: # "ocaml/message-switch/python", # "ocaml/idl/ocaml_backend/python", # "ocaml/xapi-storage/python", + "ocaml/xenopsd/python", ] disable = [ "import-error", # xenfsimage, xcp.bootloader. xcp.cmd diff --git a/scripts/hfx_filename b/scripts/hfx_filename index 0c008d9d824..3e94f87f6e3 100755 --- a/scripts/hfx_filename +++ b/scripts/hfx_filename @@ -51,6 +51,7 @@ def rpc(session_id, request): s.close() def parse_string(txt): + assert isinstance(txt, str) prefix = "success" if not txt.startswith(prefix): raise Exception("Unable to parse string response")