From d9d6f70958d58ce2967fb9c60de697983d1daa85 Mon Sep 17 00:00:00 2001 From: Lindsey Heagy Date: Sun, 31 Jan 2016 12:45:51 -0800 Subject: [PATCH] better description of paths in test_docs --- tests/docs/test_docs.py | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/tests/docs/test_docs.py b/tests/docs/test_docs.py index cb060743..cee68206 100644 --- a/tests/docs/test_docs.py +++ b/tests/docs/test_docs.py @@ -2,19 +2,41 @@ import subprocess import unittest import os - class Doc_Test(unittest.TestCase): - def test_html(self,rmdir=True): - check = subprocess.call(["sphinx-build", "-nW", "-b", "html", "-d", "../../docs/_build/doctrees", "../../docs", "../../docs/_build/html"]) + @property + def path_to_docs(self): + dirname, filename = os.path.split(os.path.abspath(__file__)) + return os.path.sep.join(dirname.split(os.path.sep)[:-2] + ['docs']) + + def test_html(self): + doctrees_path = os.path.sep.join(self.path_to_docs.split(os.path.sep) + ['_build']+['doctrees']) + html_path = os.path.sep.join(self.path_to_docs.split(os.path.sep) + ['_build']+['html']) + + check = subprocess.call(["sphinx-build", "-nW", "-b", "html", "-d", + "%s"%(doctrees_path) , + "%s"%(self.path_to_docs), + "%s"%(html_path)]) assert check == 0 - def test_latex(self,rmdir=True): - check = subprocess.call(["sphinx-build", "-nW", "-b", "latex", "-d", "../../docs/_build/doctrees", "../../docs", "../../docs/_build/latex"]) + def test_latex(self): + doctrees_path = os.path.sep.join(self.path_to_docs.split(os.path.sep) + ['_build']+['doctrees']) + latex_path = os.path.sep.join(self.path_to_docs.split(os.path.sep) + ['_build']+['latex']) + + check = subprocess.call(["sphinx-build", "-nW", "-b", "latex", "-d", + "%s"%(doctrees_path), + "%s"%(self.path_to_docs), + "%s"%(latex_path)]) assert check == 0 - def test_linkcheck(self,rmdir=True): - check = subprocess.call(["sphinx-build", "-nW", "-b", "linkcheck", "-d", "../../docs/_build/doctrees", "../../docs", "../../docs/_build"]) + def test_linkcheck(self): + doctrees_path = os.path.sep.join(self.path_to_docs.split(os.path.sep) + ['_build']+['doctrees']) + link_path = os.path.sep.join(self.path_to_docs.split(os.path.sep) + ['_build']) + + check = subprocess.call(["sphinx-build", "-nW", "-b", "linkcheck", "-d", + "%s"%(doctrees_path), + "%s"%(self.path_to_docs), + "%s"%(link_path)]) assert check == 0 if __name__ == '__main__':