Home | History | Annotate | Download | only in pkg_test4
      1 # Tests proper handling of lextab and parsetab files in package structures
      2 # Check of warning messages when files aren't writable
      3 
      4 # Here for testing purposes
      5 import sys
      6 if '..' not in sys.path:  
      7     sys.path.insert(0, '..')
      8 
      9 import ply.lex
     10 import ply.yacc
     11 
     12 def patched_open(filename, mode):
     13     if 'w' in mode:
     14         raise IOError("Permission denied %r" % filename)
     15     return open(filename, mode)
     16 
     17 ply.lex.open = patched_open
     18 ply.yacc.open = patched_open
     19 try:
     20     from .parsing.calcparse import parser
     21 finally:
     22     del ply.lex.open
     23     del ply.yacc.open
     24 
     25 
     26