No tests for node editor and operators?

I don’t see anything related to nodes in source/tests. Do I miss something?

There are indeed no tests for this part of Blender.

What a shame!

Can I contribute to this part and write the missing tests?

1 Like

Sure! I already started working on it, see T67057

For modifiers and operators the framework should be done, so simply look at operators.py or modifiers.py to see examples on how to add tests (should be only 1 line of code)

For nodes (T71834), I’m working on another approach and trying to reuse the reports generator from cycles to generate and execute compositor tests (see also discussion with sergey in D6334)

1 Like

My concerns are mainly about shader nodes and nodes API in general, and their states such as proper user counting, or calling custom init, copy or free methods for NodeCustomGroups. This harly can be tested with the compositor image comparing approach.

Also, I miss, which operator.py do you refer to?

I meant https://developer.blender.org/differential/changeset/?ref=227757
It’s actually meant to test mesh operators only so for the functions you mentioned you probably need something different.

I suppose, the tests’ should cover all cases of creating/copying/deleting nodes/trees, including custom groups and “volatile” custom groups that change their trees. And checking their user counters and api functions being called.

I found 14 cases of calling broken BKE_node_copy. 8 of them are from operators and kinda easy to test right from python. 1 case is id_single_user, 2 are recursive fom BKE_id_copy_ex and hard to track
And 2 cases are from ntreeLocalize, DEG::id_copy_inplace_no_main which happen insane number of times, and which I don’t understand completely.

Any ideas how to organize such testing?