Skip to content

Update codecov #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 23, 2023
Merged
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
11 changes: 9 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: test

on: pull_request
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
Expand Down Expand Up @@ -55,4 +59,7 @@ jobs:
- name: Run tests
run: |
source $VENV
pytest tests/
pytest -v --cov-report xml:coverage.xml --cov=muvi --color=yes

- name: Upload coverage
uses: codecov/codecov-action@v3
18 changes: 18 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Run to check if valid
# curl --data-binary @codecov.yml https://codecov.io/validate
codecov:
require_ci_to_pass: false

coverage:
status:
project:
default:
# Require 1% coverage, i.e., always succeed
target: 1
patch: false
changes: false

comment:
layout: "diff, flags, files"
behavior: once
require_base: false
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ exclude = [
"tests",
]


[tool.pytest.ini_options]
testpaths = ["tests"]


[tool.coverage.report]
exclude_lines = [
"pragma: no cover"
]
omit = [
"**/tests/*"
]
6 changes: 1 addition & 5 deletions tests/test_get_free_gpu.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import pytest
import torch
from muvi import get_free_gpu_idx


def test_early_stopping_callback():
def test_get_free_gpu_idx():
if torch.cuda.is_available():
gpu_idx = get_free_gpu_idx()
assert gpu_idx >= 0
else:
with pytest.raises(RuntimeError):
get_free_gpu_idx()