Mercurial > repo
comparison ply-3.8/test/pkg_test4/__init__.py @ 7267:343ff337a19b
<ais523> ` tar -xf ply-3.8.tar.gz
author | HackBot |
---|---|
date | Wed, 23 Mar 2016 02:40:16 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
7266:61a39a120dee | 7267:343ff337a19b |
---|---|
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 |