Version control system wrapper allowing the developer to worry about only having to learn one command set to manage all types of repositories.

umbrella.py 942B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/python
  2. import coverage
  3. import os
  4. import unittest
  5. # Store our output to the file
  6. output = ""
  7. # Start the coverage
  8. cov = coverage.coverage()
  9. cov.start()
  10. # Dynamically get all the test cases we can find.
  11. suite = unittest.TestSuite()
  12. suite.addTests(unittest.TestLoader().discover(os.getcwd(), pattern="*.py"))
  13. # Run the tests
  14. unittest.TextTestRunner().run(suite)
  15. # Stop coverage and save the stats
  16. cov.stop()
  17. cov.save()
  18. # Iterate through the tested files
  19. for source in cov.data.measured_files():
  20. for a in [cov.analysis2(source)]:
  21. output += "{0};{1};{2};{3};\n".format(
  22. a[0],
  23. ",".join(str(x) for x in a[1]),
  24. ",".join(str(x) for x in a[2]),
  25. ",".join(str(x) for x in a[3]))
  26. # Write the coverage report for umbrella
  27. fileName = ".umbrella-coverage"
  28. if os.path.isfile(fileName):
  29. os.remove(fileName)
  30. f = open(fileName, "w")
  31. f.write(output)
  32. f.close()