-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathdeprecationtest.py
57 lines (52 loc) · 1.58 KB
/
deprecationtest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import sys
import os
import unittest
from pypreprocessor import pypreprocessor
pypreprocessor.readEncoding = 'utf-8'
pypreprocessor.writeEncoding = 'utf-8'
def testsuite():
suite = unittest.TestSuite()
suite.addTests(unittest.makeSuite(DeprecationTest))
return suite
class DeprecationTest(unittest.TestCase):
@classmethod
def setUpClass(self):
pypreprocessor.defines = []
os.chdir('./tests')
pass
@classmethod
def tearDownClass(self):
os.chdir('./..')
pass
def setUp(self):
super(DeprecationTest, self).setUp()
pypreprocessor.input = './parseTarget.py'
pypreprocessor.output = self._testMethodName
pass
def tearDown(self):
f = os.path.join(os.getcwd(), pypreprocessor.output)
pypreprocessor.defines = []
if(os.path.exists(f)):
os.remove(f)
super(DeprecationTest, self).tearDown()
pass
def test_mode(self):
pypreprocessor.mode = 'ppcont'
pypreprocessor.run = True
pypreprocessor.resume = True
pypreprocessor.save = False
pypreprocessor.parse()
self.assertFalse(os.path.exists(pypreprocessor.output))
pass
def test_escapeChar(self):
pypreprocessor.escapeChar = '$'
pypreprocessor.escape = '#[pypreprocessor]#'
pypreprocessor.run = True
pypreprocessor.resume = True
pypreprocessor.save = False
pypreprocessor.parse()
self.assertFalse(os.path.exists(pypreprocessor.output))
pass
pass
if(__name__ == 'main'):
unittest.main()