listing16-3.py 568 B

123456789101112131415161718
  1. import unittest, my_math
  2. from subprocess import Popen, PIPE
  3. class ProductTestCase(unittest.TestCase):
  4. # Insert previous tests here
  5. def test_with_PyChecker(self):
  6. cmd = 'pychecker', '-Q', my_math.__file__.rstrip('c')
  7. pychecker = Popen(cmd, stdout=PIPE, stderr=PIPE)
  8. self.assertEqual(pychecker.stdout.read(), '')
  9. def test_with_PyLint(self):
  10. cmd = 'pylint', '-rn', 'my_math'
  11. pylint = Popen(cmd, stdout=PIPE, stderr=PIPE)
  12. self.assertEqual(pylint.stdout.read(), '')
  13. if __name__ == '__main__': unittest.main()