-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaya_test.py
More file actions
106 lines (70 loc) · 2.43 KB
/
Copy pathmaya_test.py
File metadata and controls
106 lines (70 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/python
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permission.
#
#
#
__all__ = ['MayaTest']
import unittest
import xmlrpclib, sys, os, shutil
class MayaTest(unittest.TestCase):
'''Test the basic level interaction to Maya'''
def test_all(my):
from tactic_client_lib.application.common import TacticNodeUtil
my.util = TacticNodeUtil()
from tactic_client_lib.application.maya import Maya
my.app = Maya()
my._test_nodes()
my._test_attributes()
my._test_file()
def _test_nodes(my):
# create a test node
node_name = "test_node"
created_name = my.app.add_node(node_name)
my.assertEquals(node_name, created_name)
# test to see whether it exists
exists = my.app.node_exists(created_name)
my.assertEquals(True, exists)
# create a node of the same name
created_name2 = my.app.add_node(node_name)
my.assertEquals("test_node1", created_name2)
# create a node that should be unique
created_name3 = my.app.add_node(node_name, unique=True)
my.assertEquals("test_node", created_name3)
# get the nodes by name pattern
pattern = "test_*"
nodes = my.app.get_nodes_by_name(pattern)
my.assertEquals(['test_node','test_node1'], nodes)
def _test_attributes(my):
'''tests various attribute functionality'''
def _test_file(my):
if os.name == "nt":
dir = "C:/sthpw/temp"
else:
dir = "/tmp/sthpw/temp"
if not os.path.exists(dir):
os.makedirs(dir)
path = '%s/test' % dir
if os.path.exists(path):
os.unlink(path)
path = my.app.save(path)
my.assertEquals(True, os.path.exists(path))
# remove the file
if os.path.exists(path):
os.unlink(path)
def main():
import sys
sys.path.insert(0, "C:/Program Files/Southpaw/Tactic1.9/src/client")
try:
unittest.main()
except SystemExit:
pass
main = staticmethod(main)
if __name__ == "__main__":
MayaTest.main()