diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 31a6333..de17ff0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 604b0bb..7bb271b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 \ No newline at end of file +[tool.setuptools] +packages = ["csv_importer"] \ No newline at end of file diff --git a/tests/run.py b/tests/run.py new file mode 100644 index 0000000..2279ad8 --- /dev/null +++ b/tests/run.py @@ -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()