Skip to content

Commit

Permalink
add better test coverage of serializing nodes, improve test command
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdon committed Jun 28, 2024
1 parent 78b293d commit 071d124
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
21 changes: 18 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,25 @@ dev() {
}

test() {
if ! [[ "$1" ]]; then
echo "usage: setup.sh test [MAYAVERSION] ..."
return
fi

build
echo "Running tests..."
mayapy tests build/$PACKAGE_NAME
echo "Be sure to run 'setup.sh dev' first."

for version in "$@"
do
# find mayapy
mayapy="$PROGRAMFILES/Autodesk/Maya${version}/bin/mayapy.exe"
# log maya version
py_version=`"$mayapy" -V`
printf "\n> Maya ${version} (${py_version})\n"
# run tests
"$mayapy" tests build/$PACKAGE_NAME
done
}

install() {
Expand Down Expand Up @@ -94,11 +110,10 @@ link() {
fi
}
# run command by name
if [[ "$1" ]]; then
cd $(dirname "$0")
$1
$1 "${@:2}"
else
echo -e "usage: setup.sh [COMMAND]\n $ALL_COMMANDS"
fi
11 changes: 10 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ def tearDown(self):
pm.delete(self.node)

def test_set_and_get_data(self):
set_data = ["myData", {"a": 1, "b": 2}, ("x", "y", "z")]
pm.namespace(add="test_ns")
node_a = pm.group(name="node_a", empty=True)
node_b = pm.group(name="test_ns:node_b", empty=True)

set_data = [
"myData",
{"a": 1, "b": 2},
("x", "y", "z"),
[node_a, node_b],
]
class_name = "myMetaClass"
meta.set_metadata(self.node, class_name, set_data)
self.assertEqual(meta.get_metadata(self.node, class_name), set_data)
Expand Down

0 comments on commit 071d124

Please sign in to comment.