def test_apigen_functional(): |
|
|
fs_root, package_name = setup_fs_project('test_apigen_functional') |
tempdir = py.test.ensuretemp('test_apigen_functional_results') |
pydir = py.magic.autopath().dirpath().dirpath().dirpath() |
pakdir = fs_root.join('pak') |
if py.std.sys.platform == 'win32': |
cmd = ('set APIGENPATH=%s && set PYTHONPATH=%s && ' |
'python "%s/bin/py.test"') % (tempdir, fs_root, pydir) |
else: |
cmd = ('APIGENPATH="%s" PYTHONPATH="%s" ' |
'python "%s/bin/py.test"') % (tempdir, fs_root, pydir) |
try: |
output = py.process.cmdexec('%s --apigen="%s/apigen.py" "%s"' % ( |
cmd, fs_root, pakdir)) |
except py.error.Error, e: |
print e.out |
raise |
assert output.lower().find('traceback') == -1 |
|
|
apidir = tempdir.join('api') |
assert apidir.check(dir=True) |
sometestclass_api = apidir.join('main.SomeTestClass.html') |
assert sometestclass_api.check(file=True) |
html = sometestclass_api.read() |
print html |
assert '<a href="main.SomeTestClass.html">SomeTestClass</a>' in html |
assert 'someattr: <em>somevalue</em>' in html |
|
namespace_api = apidir.join('main.html') |
assert namespace_api.check(file=True) |
html = namespace_api.read() |
assert '<a href="main.SomeTestClass.html">SomeTestClass</a>' in html |
index = apidir.join('index.html') |
assert index.check(file=True) |
html = index.read() |
assert 'pkg docstring' in html |
|
sourcedir = tempdir.join('source') |
assert sourcedir.check(dir=True) |
sometestclass_source = sourcedir.join('sometestclass.py.html') |
assert sometestclass_source.check(file=True) |
html = sometestclass_source.read() |
-> assert '<div class="project_title">sources for sometestclass.py</div>' in html |
|
index = sourcedir.join('index.html') |
assert index.check(file=True) |
html = index.read() |
print html |
assert '<a href="test/index.html">test</a>' in html |
assert 'href="../../py/doc/home.html"' |