Skip to content

Commit

Permalink
Merge pull request #19 from clebergnu/lint
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja authored Feb 26, 2024
2 parents 0147431 + 585ab6b commit ca60568
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/modules-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ jobs:
uses: actions/checkout@v3

- name: Install Avocado to run tests
run: pip3 install avocado-framework==102.0
run: pip3 install 'avocado-framework<104.0'

- name: Run the ar module test
run: ./tests/test-module.py metadata/autils/archive/ar.yml
run: ./tests/test_module.py metadata/autils/archive/ar.yml

static-checks:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Install Avocado to allow for lint check on Python code under tests directory
run: pip3 install 'avocado-framework<104.0'

- name: run static checks
uses: avocado-framework/avocado-ci-tools@main
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schema-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
uses: actions/checkout@v3

- name: Validating all libraries against our schema
run: python3 tests/validate-schema.py
run: python3 tests/validate_schema.py
5 changes: 3 additions & 2 deletions autils/archive/ar.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def __next__(self):
member = struct.unpack(
FILE_HEADER_FMT, open_file.read(FILE_HEADER_SIZE)
)
except struct.error:
raise StopIteration
except struct.error as exc:
raise StopIteration from exc

# No support for extended file names
identifier = member[0].decode("ascii").strip()
Expand All @@ -105,3 +105,4 @@ def read_member(self, identifier):
with self as open_file:
open_file.seek(member.offset)
return open_file.read(member.size)
return None
2 changes: 1 addition & 1 deletion static-checks
4 changes: 2 additions & 2 deletions tests/test-module.py → tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"Fedora 37": "fedora:37",
}

metadata_path = sys.argv[1]
with open(metadata_path, "rb") as m:
METADATA_PATH = sys.argv[1]
with open(METADATA_PATH, "rb") as m:
metadata = yaml.load(m, Loader=yaml.SafeLoader)

test_suites = []
Expand Down
2 changes: 2 additions & 0 deletions tests/validate-schema.py → tests/validate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def validate_yaml(filename, schema):


def validate_yamls():
"""Validates all yamls in the repo against the autils schema."""
print("Starting validation...")
failed = False
for file in glob.glob("./metadata/autils/*/*.yml"):
Expand All @@ -53,6 +54,7 @@ def validate_yamls():
return 1

print("All files passed validation.")
return 0


if __name__ == "__main__":
Expand Down

0 comments on commit ca60568

Please sign in to comment.