Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev: Add Initial testing suite #225

Merged
merged 18 commits into from
May 17, 2023
Merged

Dev: Add Initial testing suite #225

merged 18 commits into from
May 17, 2023

Conversation

BradyAJohnston
Copy link
Owner

@BradyAJohnston BradyAJohnston commented May 16, 2023

Adds some very initial testing capabilities for the add-on.

Utilises the bpy python package build of Blender to run tests. Was previously not being released or maintained by the Blender team, but it seems that now (as of March 30) that the Blender Foundation has taken over the release of the bpy package. Potential in the future for compilation of bpy for different platforms to run the tests.

Restructures the repo to be more like a traditional python package repo, adding Manifest.in and pyproject.toml to enable installation with pip install . for MolecularNodes.

Adds tests/ folder with some initial testing files, as well as snapshots and test data in tests/data

@codecov
Copy link

codecov bot commented May 16, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@ce3c1f4). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@          Coverage Diff           @@
##             main    #225   +/-   ##
======================================
  Coverage        ?   0.00%           
======================================
  Files           ?      11           
  Lines           ?    1903           
  Branches        ?       0           
======================================
  Hits            ?       0           
  Misses          ?    1903           
  Partials        ?       0           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Now rounds the vert positions to 4 decimal places. Reduces data
required for storing the snapshots, but there was also floating
point errors when testing on my mac laptops after 5-8 decimal places
that were slightly different to other machines.

This level of accurary should be more than enough, as each vert
is being tested on 3 degrees of freedom.
@BradyAJohnston BradyAJohnston merged commit 3f1f292 into main May 17, 2023
5 checks passed
@BradyAJohnston BradyAJohnston deleted the dev-tests branch May 17, 2023 03:22
BradyAJohnston added a commit that referenced this pull request Sep 14, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant