import unittest
import os, glob

import stdio
from ctypes import POINTER, c_int

class DynModTest(unittest.TestCase):
    def tearDown(self):
        for fnm in glob.glob(stdio._gen_basename + ".*"):
            try:
                os.remove(fnm)
            except IOError:
                pass

    def test_fopen(self):
        self.failUnlessEqual(stdio.fopen.restype, POINTER(stdio.FILE))
        self.failUnlessEqual(stdio.fopen.argtypes, [stdio.STRING, stdio.STRING])

    def test_constants(self):
        self.failUnlessEqual(stdio.O_RDONLY, 0)
        self.failUnlessEqual(stdio.O_WRONLY, 1)
        self.failUnlessEqual(stdio.O_RDWR, 2)

    def test_compiler_errors(self):
        from ctypeslib.codegen.cparser import CompilerError
        from ctypeslib.dynamic_module import include
        self.failUnlessRaises(CompilerError, lambda: include("#error"))

if __name__ == "__main__":
    unittest.main()

import unittest
import os, glob

import stdio
from ctypes import POINTER, c_int

class DynModTest(unittest.TestCase):

    def test_fopen(self):
        self.failUnlessEqual(stdio.fopen.restype, POINTER(stdio.FILE))
        self.failUnlessEqual(stdio.fopen.argtypes, [stdio.STRING, stdio.STRING])

    def test_constants(self):
        self.failUnlessEqual(stdio.O_RDONLY, 0)
        self.failUnlessEqual(stdio.O_WRONLY, 1)
        self.failUnlessEqual(stdio.O_RDWR, 2)

    def test_compiler_errors(self):
        from ctypeslib.codegen.cparser import CompilerError
        from ctypeslib.dynamic_module import include
        self.failUnlessRaises(CompilerError, lambda: include("#error"))

if __name__ == "__main__":
    unittest.main()

Remove now useless TearDown method.
Remove now useless TearDown method.

git-svn-id: ac2c3632cb6543e7ab5fafd132c7fe15057a1882@53797 6015fed2-1504-0410-9fe1-9d1591cc4771

  import unittest
  import os, glob
  
  import stdio
  from ctypes import POINTER, c_int
  
  class DynModTest(unittest.TestCase):
-     def tearDown(self):
-         for fnm in glob.glob(stdio._gen_basename + ".*"):
-             try:
-                 os.remove(fnm)
-             except IOError:
-                 pass
  
      def test_fopen(self):
          self.failUnlessEqual(stdio.fopen.restype, POINTER(stdio.FILE))
          self.failUnlessEqual(stdio.fopen.argtypes, [stdio.STRING, stdio.STRING])
  
      def test_constants(self):
          self.failUnlessEqual(stdio.O_RDONLY, 0)
          self.failUnlessEqual(stdio.O_WRONLY, 1)
          self.failUnlessEqual(stdio.O_RDWR, 2)
  
      def test_compiler_errors(self):
          from ctypeslib.codegen.cparser import CompilerError
          from ctypeslib.dynamic_module import include
          self.failUnlessRaises(CompilerError, lambda: include("#error"))
  
  if __name__ == "__main__":
      unittest.main()
  
Remove now useless TearDown method.
## Code Before:
import unittest
import os, glob

import stdio
from ctypes import POINTER, c_int

class DynModTest(unittest.TestCase):
    def tearDown(self):
        for fnm in glob.glob(stdio._gen_basename + ".*"):
            try:
                os.remove(fnm)
            except IOError:
                pass

    def test_fopen(self):
        self.failUnlessEqual(stdio.fopen.restype, POINTER(stdio.FILE))
        self.failUnlessEqual(stdio.fopen.argtypes, [stdio.STRING, stdio.STRING])

    def test_constants(self):
        self.failUnlessEqual(stdio.O_RDONLY, 0)
        self.failUnlessEqual(stdio.O_WRONLY, 1)
        self.failUnlessEqual(stdio.O_RDWR, 2)

    def test_compiler_errors(self):
        from ctypeslib.codegen.cparser import CompilerError
        from ctypeslib.dynamic_module import include
        self.failUnlessRaises(CompilerError, lambda: include("#error"))

if __name__ == "__main__":
    unittest.main()

## Instruction:
Remove now useless TearDown method.
## Code After:
import unittest
import os, glob

import stdio
from ctypes import POINTER, c_int

class DynModTest(unittest.TestCase):

    def test_fopen(self):
        self.failUnlessEqual(stdio.fopen.restype, POINTER(stdio.FILE))
        self.failUnlessEqual(stdio.fopen.argtypes, [stdio.STRING, stdio.STRING])

    def test_constants(self):
        self.failUnlessEqual(stdio.O_RDONLY, 0)
        self.failUnlessEqual(stdio.O_WRONLY, 1)
        self.failUnlessEqual(stdio.O_RDWR, 2)

    def test_compiler_errors(self):
        from ctypeslib.codegen.cparser import CompilerError
        from ctypeslib.dynamic_module import include
        self.failUnlessRaises(CompilerError, lambda: include("#error"))

if __name__ == "__main__":
    unittest.main()
