From 8d5bfffd9a4eb8a38db309301be9b5adf588aec1 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Fri, 13 Sep 2024 21:20:20 +0900 Subject: [PATCH] Add pytest coverage information. (#180) * Coverage information. * Ignore on tests changes. * Ignore coveragerc. * Install pytest-cov. * Fix. * Add. * Ignore. * Ignore. * Update. * Add codecoverage. --- .coveragerc | 23 ++ .github/workflows/build-and-test.yml | 12 + .github/workflows/pytest.yml | 13 +- .github/workflows/run-on-gpu.yml | 6 + .gitignore | 1 + README.md | 9 +- tests/.coverage | Bin 0 -> 53248 bytes tests/coverage.xml | 530 +++++++++++++++++++++++++++ 8 files changed, 588 insertions(+), 6 deletions(-) create mode 100644 .coveragerc create mode 100644 tests/.coverage create mode 100644 tests/coverage.xml diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..8147b4b --- /dev/null +++ b/.coveragerc @@ -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 diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index f5a44db..3a022c8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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: diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 27bd45a..b9bf881 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -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 diff --git a/.github/workflows/run-on-gpu.yml b/.github/workflows/run-on-gpu.yml index a87ec3c..069296a 100644 --- a/.github/workflows/run-on-gpu.yml +++ b/.github/workflows/run-on-gpu.yml @@ -8,6 +8,9 @@ on: - "comfy_cli/**" - "!comfy_cli/test_**" - "!.github/**" + - "!tests/**" + - "!.coveragerc" + - "!.gitignore" pull_request: branches: - main @@ -15,6 +18,9 @@ on: - "comfy_cli/**" - "!comfy_cli/test_**" - "!.github/**" + - "!tests/**" + - "!.coveragerc" + - "!.gitignore" jobs: test-cli-gpu: diff --git a/.gitignore b/.gitignore index a501527..d37eb6a 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ python* cpython* requirements.compiled override.txt +.coverage diff --git a/README.md b/README.md index fd46af2..24daa14 100644 --- a/README.md +++ b/README.md @@ -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 Comfy Command Demo @@ -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. @@ -163,7 +164,7 @@ If you encounter bugs only with custom nodes enabled, and want to find out which `comfy model download --url ?[--relative-path ] ?[--set-civitai-api-token ]` - * URL: CivitAI, huggingface file url, ... + - URL: CivitAI, huggingface file url, ... - Model remove diff --git a/tests/.coverage b/tests/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..2415f290844d8262aaa24344d561087a597f64ba GIT binary patch literal 53248 zcmeI4Uu+!39mjWX_ipbTp9d6$t80))Lak%rKNy-uv?8&AJWxOek|Jm&j=j4%d(+$9 z%l>gpsXikR62 zo%Idze$kRPwe&)nJ)#X3Uews*<#{$a_)7Vk+uj&-OV4jRVcDfRW#9k-5C8!X_-YgA zJTz!khKKcMo{a2TOGJTP7eNx1?|yjS+<|@kz}#K;@8d}t-#NhPn4IKuJn#?mwg`CB zX$kIl4X18Lj<>+0MUj<`L(z~69i`DyCksv~c^RuZ4U&q)0;y;Rj%x?Y{6}JWLKR4B zi^P#ANgyS{S@2{DzB3gc=YeR7KzMZ#CRXfp8sh`w&ptI^Rkm-}j|Jp6<+$%N|XnV$V4gi}lW*;9bcH)eO&{;Ia|q z0pHkGsNAt#*T^fyk?>H9K5td+IP%qXl{&vVL&4y4*B7nI=%{}Dka84>r&@EOa6MA$ zahmnyKCUD4`}>U?CB04}M^UTA{iYf+Qko~7L*Be`%uHu6>_84Q?xzLG($Ce~q_JcJ zueJPIudgYO2?Y%hnhUaG&Dg8Up%ThA)cqw9*b8DR%}u6-&)bp6b!JM1%D&NluCwj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Hha*v$<=*eTpj;*YH@{eDiT3Pi=x>+jS5S+YY^+xsofA(9A zeat>&@3X(MGwd{bgA#Cn00@8p2!H?xfB*=900@8p2!H?xY(WC@%LKhxR42<)r$RxU z@_BVKO?5I1b;{*T`Vv6h|JSbDg3W + + + + + /Users/junhanhuang/Documents/comfy-cli/tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +