testxslt.py 890 B

1234567891011121314151617181920212223242526272829
  1. import os
  2. import tempfile
  3. import unittest
  4. import win32com.test.util
  5. expected_output = "The jscript test worked.\nThe Python test worked"
  6. class XSLT(win32com.test.util.TestCase):
  7. def testAll(self):
  8. output_name = tempfile.mktemp("-pycom-test")
  9. cmd = "cscript //nologo testxslt.js doesnt_matter.xml testxslt.xsl " + output_name
  10. win32com.test.util.ExecuteShellCommand(cmd, self)
  11. try:
  12. f=open(output_name)
  13. try:
  14. got = f.read()
  15. if got != expected_output:
  16. print("ERROR: XSLT expected output of %r" % (expected_output,))
  17. print("but got %r" % (got,))
  18. finally:
  19. f.close()
  20. finally:
  21. try:
  22. os.unlink(output_name)
  23. except os.error:
  24. pass
  25. if __name__=='__main__':
  26. unittest.main()