Skip to content

Commit

Permalink
Fix test running (again) (#13)
Browse files Browse the repository at this point in the history
* fix tests (again)

* update

* upgrade setup-blender

* Update tests.yml

* maybe fix linux build

* Update pyproject.toml

* Update tests.yml
  • Loading branch information
BradyAJohnston authored Jan 7, 2025
1 parent 38ec3d0 commit 864bef6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@ jobs:
max-parallel: 4
fail-fast: false
matrix:
version: ["4.2", "4.3"]
version: ["4.2.5", "4.3.2", "daily"]
os: [macos-14, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4

- uses: BradyAJohnston/setup-blender@v2
- uses: BradyAJohnston/setup-blender@v2.1
with:
version: ${{ matrix.version }}
- name: Run tests in Blender
run: |
blender -b -P tests/python.py -- -m pip install uv
blender -b -P tests/python.py -- -m uv pip install -r pyproject.toml --all-extras
blender -b -P tests/python.py -- -m uv pip install -e .
blender -b -P tests/python.py -- -m uv run --no-project --module pytest --cov --cov-report=xml
- name: Install in Blender
run: blender -b -P tests/python.py -- -m pip install ".[test]"
- name: Run Tests in Blender
run: blender -b -P tests/run.py -- -vv tests --cov --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ test = ["pytest", "pytest-cov"]
dev = ["fake-bpy-module", "tomlkit"]
docs = ["jupyter"]

[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=61.0"]

[tool.coverage.report]
fail_under = 80
[tool.setuptools]
packages = ["csv_importer"]
25 changes: 25 additions & 0 deletions tests/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pytest
import sys

argv = sys.argv
argv = argv[argv.index("--") + 1 :]


# run this script like this:
# /Applications/Blender.app/Contents/MacOS/Blender -b -P tests/run.py -- . -v
# /Applications/Blender.app/Contents/MacOS/Blender -b -P tests/run.py -- . -k test_color_lookup_supplied


def main():
# run the test suite, and we have to manually return the result value if non-zero
# value is returned for a failing test
if len(argv) == 0:
result = pytest.main()
else:
result = pytest.main(argv)
if result.value != 0:
sys.exit(result.value)


if __name__ == "__main__":
main()

0 comments on commit 864bef6

Please sign in to comment.