import sys, unittest
import bmc_test
import power_test
import xmlrunner

tests = []
tests.extend(bmc_test.tests)
#tests.extend(power_test.tests)

if __name__ == '__main__':
    for test in tests:
        test.system = sys.argv[1]
        suite = unittest.TestLoader().loadTestsFromTestCase(test)
        xmlrunner.XMLTestRunner(verbose = 1, output='test-reports').run(suite)

import sys, unittest, os
import bmc_test
import power_test
import xmlrunner

tests = []
tests.extend(bmc_test.tests)
#tests.extend(power_test.tests)

if __name__ == '__main__':
    for test in tests:
        test.system = sys.argv[1]
        suite = unittest.TestLoader().loadTestsFromTestCase(test)
        result = xmlrunner.XMLTestRunner(verbose = 1, output='test-reports').run(suite)
        if result.failures or result.errors:
            os.sys.exit(1)

Return a bad error code when a test fails
Return a bad error code when a test fails

- import sys, unittest
+ import sys, unittest, os
  import bmc_test
  import power_test
  import xmlrunner
  
  tests = []
  tests.extend(bmc_test.tests)
  #tests.extend(power_test.tests)
  
  if __name__ == '__main__':
      for test in tests:
          test.system = sys.argv[1]
          suite = unittest.TestLoader().loadTestsFromTestCase(test)
-         xmlrunner.XMLTestRunner(verbose = 1, output='test-reports').run(suite)
+         result = xmlrunner.XMLTestRunner(verbose = 1, output='test-reports').run(suite)
+         if result.failures or result.errors:
+             os.sys.exit(1)
  
Return a bad error code when a test fails
## Code Before:
import sys, unittest
import bmc_test
import power_test
import xmlrunner

tests = []
tests.extend(bmc_test.tests)
#tests.extend(power_test.tests)

if __name__ == '__main__':
    for test in tests:
        test.system = sys.argv[1]
        suite = unittest.TestLoader().loadTestsFromTestCase(test)
        xmlrunner.XMLTestRunner(verbose = 1, output='test-reports').run(suite)

## Instruction:
Return a bad error code when a test fails
## Code After:
import sys, unittest, os
import bmc_test
import power_test
import xmlrunner

tests = []
tests.extend(bmc_test.tests)
#tests.extend(power_test.tests)

if __name__ == '__main__':
    for test in tests:
        test.system = sys.argv[1]
        suite = unittest.TestLoader().loadTestsFromTestCase(test)
        result = xmlrunner.XMLTestRunner(verbose = 1, output='test-reports').run(suite)
        if result.failures or result.errors:
            os.sys.exit(1)
