Skip to main content
Known Participant
Jun 28, 2021 6:01 PM UTC
Question

Unit testing in python

Hi there,

 

Is it possible to run unit tests using the substance designer python API outside of Designer, in headless mode? Does Designer come with an interpreter that can import the sd package?

 

Thank you

This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

Nicolas3D
Community Manager
Community Manager
Jun 29, 2021 3:58 PM UTC

The only one way to run Designer in Headless mode is through SAT (Substance Automation Toolkit).
More information here: https://substance3d.adobe.com/documentation/sat

 

Nico

Translate
ihauliAuthor
Known Participant
Jun 29, 2021 4:42 PM UTC

Thank you Nicolas. Unfortunately the SAT won't help here since it's a different API, and the intent here is to test plugins code using the Designer API.

Is that on your roadmap at all to provide a headless version of Designer, for the purpose of unit testing and continuous integration, like Maya has mayapy for example?

Translate
Participating Frequently
Jun 29, 2021 8:45 AM UTC

Hi,

 

We currently don't have a standalone headless SD Python module.

One possible alternative is the use the --startup-script and --quit command line arguments when launching Designer.

I haven't run unit tests like this, but I believe it will work.

 

Est.

 

 

Translate
ihauliAuthor
Known Participant
Jun 29, 2021 4:37 PM UTC

Thank you Esteban, we will try that. 

It won't work in a Continuous Integration pipeline, but at least the engineer can run tests as a batch before opening a PR. 

Translate
ihauliAuthor
Known Participant
Jun 29, 2021 6:46 PM UTC

I guess we can also mock out the sd package and all the calls to it. Writing such tests can be tedious sometimes, and arguably the value of the tests may be lower, but our code would be covered.

Translate