[svn r38121] Same issue. Race conditions in file write. Probably we should not use

the same file output for multiple tests (or to put data directory outside
pylib itself).

--HG--
branch : trunk
This commit is contained in:
fijal 2007-02-07 21:56:51 +01:00
parent e5091b7e9d
commit 461c0b6a54
1 changed files with 33 additions and 28 deletions

View File

@ -11,36 +11,41 @@ from py.__.rest.latex import process_rest_file
datadir = py.magic.autopath().dirpath().join("data") datadir = py.magic.autopath().dirpath().join("data")
testdir = py.test.ensuretemp("rest") testdir = py.test.ensuretemp("rest")
def test_graphviz_html(): class TestGraphviz(object):
if not py.path.local.sysfind("dot"): def _graphviz_html(self):
py.test.skip("graphviz needed") if not py.path.local.sysfind("dot"):
directive.set_backend_and_register_directives("html") py.test.skip("graphviz needed")
if not py.path.local.sysfind("svn"): directive.set_backend_and_register_directives("html")
py.test.skip("svn needed") if not py.path.local.sysfind("svn"):
txt = datadir.join("graphviz.txt") py.test.skip("svn needed")
html = txt.new(ext="html") txt = datadir.join("graphviz.txt")
png = datadir.join("example1.png") html = txt.new(ext="html")
rest.process(txt) png = datadir.join("example1.png")
assert html.check() rest.process(txt)
assert png.check() assert html.check()
html_content = html.read() assert png.check()
assert png.basename in html_content html_content = html.read()
html.remove() assert png.basename in html_content
png.remove() html.remove()
png.remove()
def _graphviz_pdf(self):
if not py.path.local.sysfind("dot") or not py.path.local.sysfind("latex"):
py.test.skip("graphviz and latex needed")
def test_graphviz_pdf(): directive.set_backend_and_register_directives("latex")
if not py.path.local.sysfind("dot") or not py.path.local.sysfind("latex"): txt = py.path.local(datadir.join("graphviz.txt"))
py.test.skip("graphviz and latex needed") pdf = txt.new(ext="pdf")
dotpdf = datadir.join("example1.pdf")
process_rest_file(txt)
assert pdf.check()
assert dotpdf.check()
pdf.remove()
dotpdf.remove()
directive.set_backend_and_register_directives("latex") def test_graphviz(self):
txt = py.path.local(datadir.join("graphviz.txt")) self._graphviz_html()
pdf = txt.new(ext="pdf") self._graphviz_pdf()
dotpdf = datadir.join("example1.pdf")
process_rest_file(txt)
assert pdf.check()
assert dotpdf.check()
pdf.remove()
dotpdf.remove()
def test_own_links(): def test_own_links():
def callback(name, text): def callback(name, text):