in ptr.py [0:0]
def parse_setup_cfg(setup_py: Path) -> Dict[str, Any]:
req_cov_key_strip = "required_coverage_"
ptr_params = {} # type: Dict[str, Any]
setup_cfg = setup_py.parent / "setup.cfg"
if not setup_cfg.exists():
return ptr_params
cp = ConfigParser()
# Have configparser maintain key case - T484 error = callable
cp.optionxform = str # type: ignore
cp.read(setup_cfg)
if "ptr" not in cp:
LOG.info("{} does not have a ptr section")
return ptr_params
# Create a setup.py like ptr_params to return
ptr_params["required_coverage"] = {}
for key, value in cp["ptr"].items():
if key.startswith(req_cov_key_strip):
key = key.strip(req_cov_key_strip)
ptr_params["required_coverage"][key] = int(value)
elif key.startswith("run_") or key == "disabled":
ptr_params[key] = cp.getboolean("ptr", key)
elif key == "test_suite_timeout":
ptr_params[key] = cp.getint("ptr", key)
else:
ptr_params[key] = value
return ptr_params