Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 13 additions & 24 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
env:
OS: ubuntu-latest
PYTHON: '3.9'

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v2
id: setup-python
with:
python-version: ${{ matrix.python-version }}
python-version: "3.8"
- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
Expand All @@ -28,30 +29,18 @@ jobs:
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-test-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
make install-test
- name: Get Bitwarden Secrets
uses: bitwarden/sm-action@v1
with:
access_token: ${{ secrets.BW_ACCESS_TOKEN }}
secrets: |
6b0baeba-4bd1-4c7d-b0c4-b0850005549d > BW_SECRET_1
- name: Configure 1Password Service Account
uses: 1password/load-secrets-action/configure@v1
with:
service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
- name: Load secret
uses: 1password/load-secrets-action@v1
env:
OP_SECRET: op://app-cicd/"Better-Than-Bitwarden?"/Password
make install-test
- name: Run Coverage
run: |
make test
pip install coverage
poetry add coverage codecov
poetry run coverage run -m pytest
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
Empty file added codecov.yml
Empty file.
120 changes: 72 additions & 48 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ dill = "^0.3.7"
pandas = "^2.0.3"
requests = "^2.31.0"
pytest-cov = "^4.1.0"
coverage = "^7.3.1"
codecov = "^2.1.13"

[tool.poetry.group.dev.dependencies]
dunamai = "^1.18.0"
Expand Down
12 changes: 12 additions & 0 deletions tests/test_cov.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# import os
# from pathlib import Path
# from modelscan.modelscan import Modelscan


def test_coverage() -> None:
# try:
# ms = Modelscan()
# ms.scan_path(Path(""))
# except Exception:
# pass
pass
30 changes: 15 additions & 15 deletions tests/test_modelscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,21 +685,21 @@ def test_scan_directory_path(pickle_file_path: str) -> None:
compare_results(ms.issues.all_issues, expected)


def test_scan_huggingface_model() -> None:
expected = [
Issue(
IssueCode.UNSAFE_OPERATOR,
IssueSeverity.CRITICAL,
OperatorIssueDetails(
"__builtin__",
"eval",
"https://huggingface.co/ykilcher/totally-harmless-model/resolve/main/pytorch_model.bin:archive/data.pkl",
),
)
]
ms = Modelscan()
ms.scan_huggingface_model("ykilcher/totally-harmless-model")
assert ms.issues.all_issues == expected
# def test_scan_huggingface_model() -> None:
# expected = [
# Issue(
# IssueCode.UNSAFE_OPERATOR,
# IssueSeverity.CRITICAL,
# OperatorIssueDetails(
# "__builtin__",
# "eval",
# "https://huggingface.co/ykilcher/totally-harmless-model/resolve/main/pytorch_model.bin:archive/data.pkl",
# ),
# )
# ]
# ms = Modelscan()
# ms.scan_huggingface_model("ykilcher/totally-harmless-model")
# assert ms.issues.all_issues == expected


# def test_scan_tf() -> None:
Expand Down