Skip to content

Commit

Permalink
pyproject.toml: Migrate pytype_reporter from scripts to python3
Browse files Browse the repository at this point in the history
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
  • Loading branch information
bernhardkaindl authored and psafont committed Apr 22, 2024
1 parent c4ec768 commit 06a3d67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 59 deletions.
59 changes: 5 additions & 54 deletions pyproject.toml
Expand Up @@ -236,65 +236,16 @@ discard_messages_matching = [
"No attribute 'group' on None",
"No Node.TEXT_NODE in module xml.dom.minidom, referenced from 'xml.dom.expatbuilder'"
]
expected_to_fail = [
"scripts/hfx_filename",
"scripts/perfmon",
# Need 2to3 -w <file> and maybe a few other minor updates:
"scripts/hatests",
"scripts/backup-sr-metadata.py",
"scripts/restore-sr-metadata.py",
"scripts/nbd_client_manager.py",
# No attribute 'popen2' on module 'os' [module-attr] and a couple more:
"scripts/mail-alarm",
# SSLSocket.send() only accepts bytes, not unicode string as argument:
"scripts/examples/python/exportimport.py",
# Other fixes needed:
"scripts/examples/python/mini-xenrt.py",
"scripts/examples/python/XenAPI/XenAPI.py",
"scripts/examples/python/monitor-unwanted-domains.py",
"scripts/examples/python/shell.py",
"scripts/examples/smapiv2.py",
"scripts/static-vdis",
# add_interface: unsupported operand type(s) for +: str and UsbInterface
"scripts/usb_scan.py",
# TestUsbScan.assertIn() is called with wrong arguments(code not iterable)
"scripts/test_usb_scan.py",
"scripts/plugins/extauth-hook-AD.py",
]
expected_to_fail = []


[tool.pytype]
inputs = [
"scripts/hfx_filename",
"scripts/perfmon",
"scripts/static-vdis",
"scripts/Makefile",
"scripts/generate-iscsi-iqn",
"scripts/hatests",
"scripts/host-display",
"scripts/mail-alarm",
"scripts/print-custom-templates",
"scripts/probe-device-for-file",
"scripts/xe-reset-networking",
"scripts/xe-scsi-dev-map",
"scripts/examples/python",
"scripts/yum-plugins",
"scripts/*.py",
"python3/packages/*.py",

# To be added later,
# when converted to Python3-compatible syntax:
# "ocaml/message-switch/python",
# "ocaml/idl/ocaml_backend/python",
# "ocaml/xapi-storage/python",
"python3/",
"ocaml/xcp-rrdd",
]
disable = [
"import-error", # xenfsimage, xcp.bootloader. xcp.cmd
"ignored-abstractmethod",
"ignored-metaclass",
# https://github.com/google/pytype/issues/1130,
# https://github.com/google/pytype/issues/1485:
"pyi-error",
]
platform = "linux"
pythonpath = "scripts/examples/python:.:scripts:scripts/plugins:scripts/examples"
# Allow pytype to find the XenAPI module, the rrdd module and python3 modules:
pythonpath = "python3:scripts/examples/python:ocaml/xcp-rrdd/scripts/rrdd"
12 changes: 7 additions & 5 deletions pytype_reporter.py
Expand Up @@ -601,11 +601,13 @@ def main():
config.setdefault("expected_to_fail", [])
debug("Expected to fail: %s", ", ".join(config["expected_to_fail"]))

changed_but_in_expected_to_fail = git_diff(
"--name-only",
find_branch_point(config),
*config["expected_to_fail"],
).splitlines()
changed_but_in_expected_to_fail = []
if config["expected_to_fail"] != []:
changed_but_in_expected_to_fail = git_diff(
"--name-only",
find_branch_point(config),
*config["expected_to_fail"],
).splitlines()

if check_only_reverts_from_branch_point(config, changed_but_in_expected_to_fail):
return run_pytype_and_generate_summary(config)
Expand Down

0 comments on commit 06a3d67

Please sign in to comment.