Skip to content

Commit 8d5bfff

Browse files
authored
Add pytest coverage information. (#180)
* Coverage information. * Ignore on tests changes. * Ignore coveragerc. * Install pytest-cov. * Fix. * Add. * Ignore. * Ignore. * Update. * Add codecoverage.
1 parent 43dd482 commit 8d5bfff

File tree

8 files changed

+588
-6
lines changed

8 files changed

+588
-6
lines changed

.coveragerc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[run]
2+
source = comfy_cli
3+
omit = tests/*
4+
5+
[report]
6+
exclude_lines =
7+
pragma: no cover
8+
def __repr__
9+
if self.debug:
10+
if __name__ == .__main__.:
11+
raise NotImplementedError
12+
pass
13+
except ImportError:
14+
def parse_args
15+
@abstractmethod
16+
17+
ignore_errors = True
18+
19+
[html]
20+
directory = coverage_html_report
21+
22+
[xml]
23+
output = coverage.xml

.github/workflows/build-and-test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@ on:
33
push:
44
branches:
55
- main
6+
paths:
7+
- "comfy_cli/**"
8+
- "!.github/**"
9+
- "!tests/**"
10+
- "!.coveragerc"
11+
- "!.gitignore"
612
pull_request:
713
branches:
814
- main
15+
paths:
16+
- "comfy_cli/**"
17+
- "!.github/**"
18+
- "!tests/**"
19+
- "!.coveragerc"
20+
- "!.gitignore"
921

1022
jobs:
1123
test:

.github/workflows/pytest.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@ jobs:
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
pip install pytest
26+
pip install pytest pytest-cov
2727
pip install -e .
2828
2929
- name: Run tests
3030
env:
3131
PYTHONPATH: ${{ github.workspace }}
3232
run: |
33-
pytest
33+
pytest --cov
34+
35+
- name: Upload coverage to Codecov
36+
uses: codecov/codecov-action@v4
37+
with:
38+
token: ${{ secrets.CODECOV_TOKEN }}
39+
files: ./coverage.xml
40+
flags: unittests
41+
name: codecov-umbrella
42+
fail_ci_if_error: true

.github/workflows/run-on-gpu.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ on:
88
- "comfy_cli/**"
99
- "!comfy_cli/test_**"
1010
- "!.github/**"
11+
- "!tests/**"
12+
- "!.coveragerc"
13+
- "!.gitignore"
1114
pull_request:
1215
branches:
1316
- main
1417
paths:
1518
- "comfy_cli/**"
1619
- "!comfy_cli/test_**"
1720
- "!.github/**"
21+
- "!tests/**"
22+
- "!.coveragerc"
23+
- "!.gitignore"
1824

1925
jobs:
2026
test-cli-gpu:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ python*
5959
cpython*
6060
requirements.compiled
6161
override.txt
62+
.coverage

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Comfy-Cli: A Command Line Tool for ComfyUI
2+
23
[![Test ComfyUI Example Workflows](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows.yaml/badge.svg)](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows.yaml)
34
[![Test ComfyUI Windows with Default Workflow](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows-windows.yaml/badge.svg)](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows-windows.yaml)
45

6+
[![codecov](https://codecov.io/github/Comfy-Org/comfy-cli/graph/badge.svg?token=S64WJWD2ZX)](https://codecov.io/github/Comfy-Org/comfy-cli)
7+
58
comfy-cli is a command line tool that helps users easily install and manage
69
[ComfyUI](https://github.com/comfyanonymous/ComfyUI), a powerful open-source
710
machine learning framework. With comfy-cli, you can quickly set up ComfyUI,
811
install packages, and manage custom nodes, all from the convenience of your
912
terminal.
1013

11-
12-
1314
## Demo
1415

1516
<img src="https://github.com/yoland68/comfy-cli/raw/main/assets/comfy-demo.gif" width="400" alt="Comfy Command Demo">
@@ -150,7 +151,7 @@ comfy node [show|simple-show] [installed|enabled|not-installed|disabled|all|snap
150151
#### Bisect custom nodes
151152

152153
If you encounter bugs only with custom nodes enabled, and want to find out which custom node(s) causes the bug,
153-
the bisect tool can help you pinpoint the custom node that causes the issue.
154+
the bisect tool can help you pinpoint the custom node that causes the issue.
154155

155156
- `comfy node bisect start`: Start a new bisect session with optional ComfyUI launch args. It automatically marks the starting state as bad, and takes all enabled nodes when the command executes as the test set.
156157
- `comfy node bisect good`: Mark the current active set as good, indicating the problem is not within the test set.
@@ -163,7 +164,7 @@ If you encounter bugs only with custom nodes enabled, and want to find out which
163164

164165
`comfy model download --url <URL> ?[--relative-path <PATH>] ?[--set-civitai-api-token <TOKEN>]`
165166

166-
* URL: CivitAI, huggingface file url, ...
167+
- URL: CivitAI, huggingface file url, ...
167168

168169
- Model remove
169170

tests/.coverage

52 KB
Binary file not shown.

0 commit comments

Comments
 (0)