From 8f560628fb8117952969b1ded14040578ee4bafa Mon Sep 17 00:00:00 2001 From: Julio Nunes Avelar Date: Tue, 19 Nov 2024 21:09:25 -0300 Subject: [PATCH] Configurando Liter --- .github/workflows/pylint.yml | 2 +- README.md | 2 ++ test_runner/file.py | 9 ++++----- test_runner/verificator.py | 10 ++++++---- tests/generate_memory.py | 11 +++++------ 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index c73e032..33eaa85 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.10", "3.11"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/README.md b/README.md index c05fdb5..e60e73b 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ # Processor CI Tests + +[![Pylint](https://github.com/LSC-Unicamp/processor-ci-tests/actions/workflows/pylint.yml/badge.svg)](https://github.com/LSC-Unicamp/processor-ci-tests/actions/workflows/pylint.yml) \ No newline at end of file diff --git a/test_runner/file.py b/test_runner/file.py index 62e2e49..d12a49a 100644 --- a/test_runner/file.py +++ b/test_runner/file.py @@ -1,6 +1,7 @@ import os import glob + def read_file(name): if not os.path.isfile(name): raise FileNotFoundError(f"Error: The file '{name}' was not found.") @@ -10,19 +11,17 @@ def read_file(name): data.append(int(line.replace("\n", ""), 16)) return data, len(data) + def read_files_in_dir(path): try: - return [ - read_file(file) - for file in glob.glob(f"{path}/*.hex", recursive=True) - ] + return [read_file(file) for file in glob.glob(f"{path}/*.hex", recursive=True)] except FileNotFoundError: print(f"Error: The directory '{path}' was not found.") return [] except Exception as e: print(f"Error: {e}") return [] - + # return a list of all the paths with a directory named 'memory' in the path def list_find_paths(path): diff --git a/test_runner/verificator.py b/test_runner/verificator.py index c5fcaf4..b7d9831 100644 --- a/test_runner/verificator.py +++ b/test_runner/verificator.py @@ -1,12 +1,13 @@ # Description: Verificator for the processor-ci-tests -# Enter a path provided in this program and recursively all the tests .hex for each leaf directory create a .xml file with the results -# of the tests in that folder the XML files are saved in the test-reports directory with the name -# results_{test_path_name}_{timestamp}.xml +# Enter a path provided in this program and recursively all the tests .hex for each leaf directory create a .xml file with the results +# of the tests in that folder the XML files are saved in the test-reports directory with the name +# results_{test_path_name}_{timestamp}.xml import os from processor_ci_communication.core.serial import ProcessorCIInterface import test_runner.file as f + class Verificator: def __init__(self, path): self.path = path @@ -17,11 +18,12 @@ def run_tests(self): paths = f.get_all_test_paths(self.path) print(paths) - + def main(): verifier = Verificator("C:/Users/Usuario/Documents/processor-ci-tests/test_runner") verifier.run_tests() return 0 + if __name__ == "__main__": main() diff --git a/tests/generate_memory.py b/tests/generate_memory.py index 5136fd0..013599a 100644 --- a/tests/generate_memory.py +++ b/tests/generate_memory.py @@ -1,16 +1,15 @@ import os -import sys current_path = os.getcwd() -page_size = 16 +PAGE_SIZE = 16 files = os.listdir(f"{current_path}/memory/") references = os.listdir(f"{current_path}/reference/") -memory_file = "memory.hex" -reference_file = "reference.hex" +MEMORTY_FILE = "memory.hex" +REFERENCE_FILE = "reference.hex" def generate_reference_file() -> None: - file = open(reference_file, "w") + file = open(REFERENCE_FILE, "w") for i in references: temp_file = open(f"{current_path}/reference/{i}", "r") @@ -24,7 +23,7 @@ def generate_reference_file() -> None: def generate_memory_file() -> None: - file = open(memory_file, "w") + file = open(MEMORTY_FILE, "w") for i in files: temp_file = open(f"{current_path}/memory/{i}", "r")