diff --git a/_unittests/ut_loghelper/test_pypi_helper.py b/_unittests/ut_loghelper/test_pypi_helper.py index 19b5d234..e119fd9a 100644 --- a/_unittests/ut_loghelper/test_pypi_helper.py +++ b/_unittests/ut_loghelper/test_pypi_helper.py @@ -12,12 +12,14 @@ "this file should not be imported in that location: " + os.path.abspath(__file__)) -from pyquickhelper.loghelper import fLOG -from pyquickhelper.loghelper import enumerate_pypi_versions_date +from pyquickhelper.pycode import ExtTestCase, skipif_circleci, skipif_appveyor +from pyquickhelper.loghelper import fLOG, enumerate_pypi_versions_date class TestPypiHelper(unittest.TestCase): + @skipif_circleci("connectivity issue") + @skipif_appveyor("connectivity issue") def test_clone_repo(self): fLOG( __file__, diff --git a/_unittests/ut_sphinxext/test_gdot_extension.py b/_unittests/ut_sphinxext/test_gdot_extension.py index 1df111af..c2d1cd53 100644 --- a/_unittests/ut_sphinxext/test_gdot_extension.py +++ b/_unittests/ut_sphinxext/test_gdot_extension.py @@ -85,6 +85,25 @@ def test_gdot3_svg(self): self.assertIn("document.getElementById('gdot-", content) self.assertIn('foo {\\n \\"bar\\" -> \\"baz\\";\\n}");', content) + def test_gdot3_svg_process(self): + content = """ + before + + .. gdot:: + :format: svg + :process: + + digraph foo { + "bar" -> "baz"; + } + + after + """.replace(" ", "") + + content = rst2html(content, writer="html", keep_warnings=True) + self.assertIn("document.getElementById('gdot-", content) + self.assertIn('foo {\\n \\"bar\\" -> \\"baz\\";\\n}");', content) + def test_gdot4_png(self): content = """ before diff --git a/src/pyquickhelper/sphinxext/sphinx_gdot_extension.py b/src/pyquickhelper/sphinxext/sphinx_gdot_extension.py index 515a730c..be69af6b 100644 --- a/src/pyquickhelper/sphinxext/sphinx_gdot_extension.py +++ b/src/pyquickhelper/sphinxext/sphinx_gdot_extension.py @@ -34,6 +34,7 @@ class GDotDirective(Directive): * *script*: boolean or a string to indicate than the standard output should only be considered after this substring * *url*: url to :epkg:`viz.js`, only if format *SVG* is selected + * *process*: run the script in an another process Example:: @@ -54,7 +55,8 @@ class GDotDirective(Directive): The directive also accepts scripts producing dot graphs on the standard output. Option *script* must be specified. This extension loads - `sphinx.ext.graphviz `_ + `sphinx.ext.graphviz `_ if not added to the list of extensions: Example:: @@ -82,6 +84,7 @@ class GDotDirective(Directive): 'format': directives.unchanged, 'script': directives.unchanged, 'url': directives.unchanged, + 'process': directives.unchanged, } _default_url = "http://www.xavierdupre.fr/js/vizjs/viz.js" @@ -96,6 +99,8 @@ def run(self): else: format = '?' url = self.options.get('url', 'local') + bool_set_ = (True, 1, "True", "1", "true", '') + process = 'process' in self.options and self.options['process'] in bool_set_ if url == 'local': try: import jyquickhelper @@ -139,7 +144,7 @@ def run(self): # executes script if any content = "\n".join(self.content) if script or script == '': - stdout, stderr, _ = run_python_script(content) + stdout, stderr, _ = run_python_script(content, process=process) if stderr: raise RuntimeError( "A graph cannot be draw due to {}".format(stderr))