Skip to content

Commit

Permalink
Add pytest coverage information. (#180)
Browse files Browse the repository at this point in the history
* Coverage information.

* Ignore on tests changes.

* Ignore coveragerc.

* Install pytest-cov.

* Fix.

* Add.

* Ignore.

* Ignore.

* Update.

* Add codecoverage.
  • Loading branch information
robinjhuang committed Sep 13, 2024
1 parent 43dd482 commit 8d5bfff
Show file tree
Hide file tree
Showing 8 changed files with 588 additions and 6 deletions.
23 changes: 23 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[run]
source = comfy_cli
omit = tests/*

[report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if __name__ == .__main__.:
raise NotImplementedError
pass
except ImportError:
def parse_args
@abstractmethod

ignore_errors = True

[html]
directory = coverage_html_report

[xml]
output = coverage.xml
12 changes: 12 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@ on:
push:
branches:
- main
paths:
- "comfy_cli/**"
- "!.github/**"
- "!tests/**"
- "!.coveragerc"
- "!.gitignore"
pull_request:
branches:
- main
paths:
- "comfy_cli/**"
- "!.github/**"
- "!tests/**"
- "!.coveragerc"
- "!.gitignore"

jobs:
test:
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install pytest pytest-cov
pip install -e .
- name: Run tests
env:
PYTHONPATH: ${{ github.workspace }}
run: |
pytest
pytest --cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
6 changes: 6 additions & 0 deletions .github/workflows/run-on-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ on:
- "comfy_cli/**"
- "!comfy_cli/test_**"
- "!.github/**"
- "!tests/**"
- "!.coveragerc"
- "!.gitignore"
pull_request:
branches:
- main
paths:
- "comfy_cli/**"
- "!comfy_cli/test_**"
- "!.github/**"
- "!tests/**"
- "!.coveragerc"
- "!.gitignore"

jobs:
test-cli-gpu:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ python*
cpython*
requirements.compiled
override.txt
.coverage
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Comfy-Cli: A Command Line Tool for ComfyUI

[![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)
[![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)

[![codecov](https://codecov.io/github/Comfy-Org/comfy-cli/graph/badge.svg?token=S64WJWD2ZX)](https://codecov.io/github/Comfy-Org/comfy-cli)

comfy-cli is a command line tool that helps users easily install and manage
[ComfyUI](https://github.com/comfyanonymous/ComfyUI), a powerful open-source
machine learning framework. With comfy-cli, you can quickly set up ComfyUI,
install packages, and manage custom nodes, all from the convenience of your
terminal.



## Demo

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

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

- `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.
- `comfy node bisect good`: Mark the current active set as good, indicating the problem is not within the test set.
Expand All @@ -163,7 +164,7 @@ If you encounter bugs only with custom nodes enabled, and want to find out which

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

* URL: CivitAI, huggingface file url, ...
- URL: CivitAI, huggingface file url, ...

- Model remove

Expand Down
Binary file added tests/.coverage
Binary file not shown.
Loading

0 comments on commit 8d5bfff

Please sign in to comment.