-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from BradyAJohnston/dev-tests
Dev: Add Initial testing suite Now that a [recent version of bpy](https://pypi.org/project/bpy/) is built and available on PyPi, this enables testing of the addon through `pytest` like other python-based projects. I have set up the workflows for running automatic testing on Windows and Linux machines, but there is a `segfault` error on macOS machines when running on GitHub actions. The tests run fine on my own 2017 MacBook pro, but I haven't looked into it much what the error might be. In previously having discussion with the Blender devs, applying the modifiers and then comparing vertices might be the best strategy for doing snapshot tests. I have a couple of tests so far, which do exactly that for the regular import, cartoon and ribbon methods. There is also a method which tests importing via `.pdb` / `.cif` and downloading from the PDB and ensures their verts are the same. Currently these tests are just positionally based, though the other attributes will also be testable. Best to get some initial tests added and put into the workflow so that potentially others can contribute also. There are errors with importing `pyopenvdb` when using the `bpy` addon. It seems that the library isn't installed into the local python, and instead is called from within the addon itself to load volume files. This currently limits the ability to write any tests involving the volumetric import, but something to work on in the future.
- Loading branch information
Showing
17 changed files
with
5,525 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Documentation | ||
name: docs-build-deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: test-addon | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
max-parallel: 4 | ||
fail-fast: false | ||
matrix: | ||
blender-version: ["3.5.0"] | ||
os: [ubuntu-latest, windows-latest] | ||
# os: [ubuntu-latest] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
cache: 'pip' | ||
- run: pip install bpy==${{ matrix.blender-version }} | ||
- run: pip install -r requirements.txt | ||
|
||
- name: Install MolecularNodes | ||
run: pip install . | ||
|
||
- name: Run Tests | ||
run: pytest --verbose --cov=MolecularNodes --cov-report=xml:coverage.xml | ||
|
||
- name: Expose coverage as a CI download # Related to test_addon_blender_advanced.py | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: coverage.xml | ||
path: coverage.xml | ||
# setup ssh to check on file system state | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ logs/side-packages-install.log | |
*.pyc | ||
.Rproj.user | ||
/.quarto/ | ||
*egg*/* | ||
build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include MolecularNodes/assets/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
docs-build: | ||
cd docs && quartodoc build | ||
quarto render docs | ||
|
||
test: | ||
pip3 install . | ||
pytest -vv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
/.quarto/ | ||
/.quarto/ | ||
reference/* | ||
_build/* | ||
objects.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[build-system] | ||
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.pytest.ini_options] | ||
markers = [ | ||
] | ||
testpaths = [ | ||
"tests" | ||
] | ||
|
||
[project] | ||
name = "MolecularNodes" | ||
version = "2.6.2" | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["."] | ||
|
||
[tool.setuptools] | ||
# ... | ||
# By default, include-package-data is true in pyproject.toml, so you do | ||
# NOT have to specify this line. | ||
include-package-data = true | ||
|
||
[tool.setuptools_scm] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pytest | ||
pytest-snapshot | ||
pytest-cov | ||
biotite==0.37.0 # General parsing of structural files. | ||
MDAnalysis==2.2.0 # Reading of molecular dynamics trajectories. | ||
mrcfile==1.4.3 # Importing EM density files. | ||
starfile==0.4.11 # Importing star files. | ||
eulerangles==1.0.1 # Handling euler angle in starfiles. |
Oops, something went wrong.