mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Improving SauceLabs integration
This commit is contained in:
parent
01840fe98f
commit
1fbf538370
@ -42,12 +42,6 @@ def add_test_case_to_suite(suite, tc_name):
|
|||||||
for i in range(0, n):
|
for i in range(0, n):
|
||||||
suite.addTest(tc_name)
|
suite.addTest(tc_name)
|
||||||
|
|
||||||
def get_suite():
|
|
||||||
suite = TestSuite()
|
|
||||||
add_test_case_to_suite(suite, My_login_test('tc_login'))
|
|
||||||
add_test_case_to_suite(suite, My_login_test('tc_logout'))
|
|
||||||
return suite
|
|
||||||
|
|
||||||
class TracingStreamResult(testtools.StreamResult):
|
class TracingStreamResult(testtools.StreamResult):
|
||||||
failures = []
|
failures = []
|
||||||
success = []
|
success = []
|
||||||
@ -63,6 +57,7 @@ class TracingStreamResult(testtools.StreamResult):
|
|||||||
|
|
||||||
elif test_status=='uxsuccess' or test_status=='success':
|
elif test_status=='uxsuccess' or test_status=='success':
|
||||||
self.success.append(test_id)
|
self.success.append(test_id)
|
||||||
|
pdb.set_trace()
|
||||||
|
|
||||||
elif test_status=='exists':
|
elif test_status=='exists':
|
||||||
self.errors.append(test_id)
|
self.errors.append(test_id)
|
||||||
@ -86,35 +81,17 @@ else:
|
|||||||
suite = tests
|
suite = tests
|
||||||
concurrent_suite = testtools.ConcurrentStreamTestSuite(lambda: (split_suite_into_chunks(num_threads, suite)))
|
concurrent_suite = testtools.ConcurrentStreamTestSuite(lambda: (split_suite_into_chunks(num_threads, suite)))
|
||||||
result = TracingStreamResult()
|
result = TracingStreamResult()
|
||||||
result.startTestRun()
|
try:
|
||||||
concurrent_suite.run(result)
|
result.startTestRun()
|
||||||
|
finally:
|
||||||
|
concurrent_suite.run(result)
|
||||||
|
|
||||||
#Update Saouce Labs jobs
|
print "Tests failed: %s" % result.failures
|
||||||
sauce_client = SauceClient(environ["SAUCE_USERNAME"], environ["SAUCE_ACCESS_KEY"])
|
print "Tests succeeded: %s" % result.success
|
||||||
c = result
|
print "Tests skipped: %s" % result.skipped
|
||||||
for test_id in c.failures+c.skipped+c.errors:
|
print "Tests with errors: %s" % result.errors
|
||||||
try:
|
|
||||||
sauce_client.jobs.update_job(test.sauce_labs_job_id, passed=False,tags=[environ["TRAVIS_BRANCH"],test_id],build_num=environ["TRAVIS_JOB_NUMBER"],name=str(environ["TRAVIS_COMMIT"])+"_"+str(test_id.split('.')[1]))
|
|
||||||
except:
|
|
||||||
print "Could not annotate Sauce Labs job #%s" % str(test_id)
|
|
||||||
next
|
|
||||||
|
|
||||||
for test_id in c.success:
|
if (len(result.failures)+len(result.errors)+len(result.skipped)) != 0:
|
||||||
try:
|
|
||||||
sauce_client.jobs.update_job(test.sauce_labs_job_id, passed=True,tags=[environ["TRAVIS_BRANCH"],test_id],build_num=environ["TRAVIS_JOB_NUMBER"],name=str(environ["TRAVIS_COMMIT"])+"_"+str(test_id.split('.')[1]))
|
|
||||||
except:
|
|
||||||
print "Could not annotate Sauce Labs job #%s" % str(test_id)
|
|
||||||
next
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print "Tests failed: %s" % c.failures
|
|
||||||
print "Tests succeeded: %s" % c.success
|
|
||||||
print "Tests skipped: %s" % c.skipped
|
|
||||||
print "Tests with errors: %s" % c.errors
|
|
||||||
|
|
||||||
if (len(c.failures)+len(c.errors)+len(c.skipped)) != 0:
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user