[efe1d1]: Test / CanNotProve / CanNotProve2.tst Maximize Restore History

Download this file

CanNotProve2.tst    46 lines (31 with data), 1.3 kB

 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
# CanNotProve1.tst
We're going to create a zipped egg file with a compiled CanNotProve example in
it and see if pyke can load its compiled files from the zip file.
First, create the egg (in Test/dist) using Test/setup.py:
>>> import os
>>> os.chdir('..') # up to Test directory
>>> import sys
>>> sys.argv = ['Test/setup.py', '--quiet', 'bdist_egg']
>>> from Test import setup # This runs setup.py
Now, move up another level (so that 'CanNotProve' is not a subdirectory)
>>> os.chdir('..') # up to root source directory
Add the egg to the python path:
>>> import glob
>>> sys.path.insert(0, glob.glob('Test/dist/CanNotProve*.egg')[0])
Now try the test!
>>> from CanNotProve import test
>>> test.__loader__ # doctest: +ELLIPSIS
<zipimporter ...>
>>> test.Rule_package = 'CanNotProve'
>>> test.dotests()
And finally, delete the files created by Test/setup.py
>>> def rm_r(dir):
... for root, dirs, files in os.walk(dir, topdown=False):
... for name in files:
... os.remove(os.path.join(root, name))
... for name in dirs:
... os.rmdir(os.path.join(root, name))
... os.rmdir(dir)
>>> rm_r('Test/build')
>>> rm_r('Test/dist')
>>> rm_r('Test/CanNotProve.egg-info')