@@ -21,9 +21,9 @@ def __init__(self, url, environment):
21
21
'.gitignore'
22
22
]
23
23
24
- def run (self , operation , libraries = None ):
24
+ def run (self , operation , test = None , libraries = None ):
25
25
if operation == 'common' :
26
- self .common ()
26
+ self .common (test )
27
27
elif operation == 'libraries' :
28
28
self .libraries ()
29
29
elif operation == 'examples' :
@@ -38,6 +38,8 @@ def run(self, operation, libraries=None):
38
38
self .walkthrough ()
39
39
elif operation == 'staging' :
40
40
self .staging ()
41
+ elif operation == 'delete' :
42
+ self .delete ()
41
43
42
44
def run_command (self , command ):
43
45
command = ' ' .join (command )
@@ -79,8 +81,11 @@ def send_mail_with_logs(self, identifier):
79
81
def create_command (self , test_directory , * extra_arguments ):
80
82
return ['tox' , 'tests/' + test_directory , '--' , '--url={}' .format (TARGETS [self .url ])] + list (extra_arguments )
81
83
82
- def common (self , identifier = 'common' ):
83
- command = self .create_command ('common' , '--plugin' )
84
+ def common (self , test , identifier = 'common' ):
85
+ test_directory = 'common'
86
+ if test :
87
+ test_directory = os .path .join (test_directory , test )
88
+ command = self .create_command (test_directory , '--plugin' )
84
89
retval = self .run_command (command )
85
90
if retval != 0 :
86
91
self .send_mail_no_logs (identifier )
@@ -128,6 +133,10 @@ def staging(self):
128
133
command = self .create_command ('compile_tester' , '-F' , '--plugin' )
129
134
self .run_command (command )
130
135
136
+ def delete (self ):
137
+ command = self .create_command ('delete_sketches' )
138
+ self .run_command (command )
139
+
131
140
OPERATIONS = {
132
141
'common' :'\t Test site common functionality' ,
133
142
'libraries' : 'Visit all libraries and their examples' ,
@@ -136,7 +145,8 @@ def staging(self):
136
145
'compile' : '\t Compile specific examples' ,
137
146
'noplugin' : 'Run tests without app/plugin installed' ,
138
147
'walkthrough' : 'Run tests for walkthrough' ,
139
- 'staging' : '\t Run tests for staging only'
148
+ 'staging' : '\t Run tests for staging only' ,
149
+ 'delete' : '\t Delete all sketches from test user'
140
150
}
141
151
142
152
TARGETS = {
@@ -189,9 +199,12 @@ def main():
189
199
parser .add_argument ('--config' ,
190
200
default = 'config.cfg' ,
191
201
help = 'Configuration file to load (default: config.cfg).' )
202
+ parser .add_argument ('--test' ,
203
+ default = None ,
204
+ help = 'Common test to run when using operation: common (default: all)' )
192
205
parser .add_argument ('--libraries' ,
193
206
default = None ,
194
- help = 'Libraries to test (comma separated machine names) when using option : target' )
207
+ help = 'Libraries to test (comma separated machine names) when using operation : target' )
195
208
parser .add_argument ('--saucelabs' ,
196
209
action = 'store_true' ,
197
210
default = False ,
@@ -214,6 +227,8 @@ def main():
214
227
parser .print_help ()
215
228
sys .exit ()
216
229
230
+ test = args .test
231
+
217
232
libraries = args .libraries
218
233
if operation == 'target' and not libraries :
219
234
print ('No target libraries specified!\n ' )
@@ -258,7 +273,7 @@ def main():
258
273
259
274
# Run tests
260
275
tests = Tests (target , config )
261
- tests .run (operation , libraries = libraries )
276
+ tests .run (operation , test = test , libraries = libraries )
262
277
263
278
if __name__ == '__main__' :
264
279
main ()
0 commit comments