* Create ci.yml

* include pytest

* Update pyproject.toml

* include pytest-cov

* use approx in pytest

* Update test_faces.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add coverage yaml

* reduce passing grade

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Этот коммит содержится в:
Inga Ulusoy 2022-10-05 11:25:48 +02:00 коммит произвёл GitHub
родитель 1f8166e731
Коммит 2dd1a7952f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 58 добавлений и 3 удалений

39
.github/workflows/ci.yml поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,39 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [3.9]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
- name: Run pytest
run: |
cd misinformation
python -m pytest -s --cov=. --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
files: misinformation/coverage.xml

11
codecov.yml Обычный файл
Просмотреть файл

@ -0,0 +1,11 @@
codecov:
require_ci_to_pass: yes
coverage:
status:
project:
default:
target: 0
patch:
default:
target: 80

Просмотреть файл

@ -1,5 +1,6 @@
import misinformation.faces as fc
import json
from pytest import approx
def test_analyse_faces():
@ -22,4 +23,4 @@ def test_analyse_faces():
if type(mydict["emotion"][i]) == tuple
else mydict["emotion"][i]
)
assert temp == out_dict["emotion"][i]
assert approx(temp) == out_dict["emotion"][i]

Просмотреть файл

@ -35,10 +35,12 @@ dependencies = [
"tensorflow",
"keras",
"openpyxl",
"pytest",
"pytest-cov",
]
[project.scripts]
misinformation_prefetch_models = "misinformation.utils:misinformation_prefetch_models"
[tool.setuptools]
packages = ["misinformation"]
packages = ["misinformation"]

Просмотреть файл

@ -11,4 +11,6 @@ retina_face
setuptools
tensorflow
keras
openpyxl
openpyxl
pytest
pytest-cov