Add typehints to picamera_tests script
This commit is contained in:
parent
83d7d20fdd
commit
212374a6f9
1 changed files with 4 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ HASHED_FILES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def _get_hashes(include_coverage=False):
|
def _get_hashes(include_coverage: bool = False) -> dict[str, str]:
|
||||||
"""Return a dictionary of Git hashes for the HASHED FILES.
|
"""Return a dictionary of Git hashes for the HASHED FILES.
|
||||||
|
|
||||||
The key is the posixpath to the file so matching works even if the dictionary is
|
The key is the posixpath to the file so matching works even if the dictionary is
|
||||||
|
|
@ -49,7 +49,7 @@ def _get_hashes(include_coverage=False):
|
||||||
return hashes
|
return hashes
|
||||||
|
|
||||||
|
|
||||||
def run_tests():
|
def run_tests() -> None:
|
||||||
"""Run the picamera tests, zip the coverage database, hash relevant source files."""
|
"""Run the picamera tests, zip the coverage database, hash relevant source files."""
|
||||||
subprocess.run(["pytest", "hardware-specific-tests"], check=True)
|
subprocess.run(["pytest", "hardware-specific-tests"], check=True)
|
||||||
shutil.copyfile(".coverage", COVERAGE_FILE)
|
shutil.copyfile(".coverage", COVERAGE_FILE)
|
||||||
|
|
@ -61,7 +61,7 @@ def run_tests():
|
||||||
zipf.write(HASH_FILE)
|
zipf.write(HASH_FILE)
|
||||||
|
|
||||||
|
|
||||||
def unzip_coverage():
|
def unzip_coverage() -> None:
|
||||||
"""Unzip coverage database if hashes match relevant source files."""
|
"""Unzip coverage database if hashes match relevant source files."""
|
||||||
if zipfile.is_zipfile(ZIP_FILE):
|
if zipfile.is_zipfile(ZIP_FILE):
|
||||||
with zipfile.ZipFile(ZIP_FILE, "r") as zip_obj:
|
with zipfile.ZipFile(ZIP_FILE, "r") as zip_obj:
|
||||||
|
|
@ -89,7 +89,7 @@ def unzip_coverage():
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main() -> None:
|
||||||
"""Either run tests or unzip previous results."""
|
"""Either run tests or unzip previous results."""
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description=(
|
description=(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue