Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: cimg/python:3.10.5
- image: cimg/python:3.11.0

working_directory: ~/repo

Expand All @@ -18,8 +18,8 @@ jobs:
name: Install pandoc
command: |
sudo apt-get update
wget https://github.com/jgm/pandoc/releases/download/2.16.2/pandoc-2.16.2-1-amd64.deb
sudo dpkg -i pandoc-2.16.2-1-amd64.deb
wget https://github.com/jgm/pandoc/releases/download/2.19.2/pandoc-2.19.2-1-amd64.deb
sudo dpkg -i pandoc-2.19.2-1-amd64.deb

- run:
name: Install tex (unstable)
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: true
language: python
matrix:
include:
- python: 3.10
- python: 3.11
install:
- pip install -r requirements.txt
- npm install
Expand Down
31 changes: 9 additions & 22 deletions _unittests/ut_helpgen/test_changes_graph.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
"""
@brief test log(time=1s)
@author Xavier Dupre
"""

import sys
import os
import unittest
import warnings
import pandas

from pyquickhelper.loghelper.flog import fLOG
from pyquickhelper.helpgen.sphinx_main_helper import produce_code_graph_changes
from pyquickhelper.pycode import fix_tkinter_issues_virtualenv
from pyquickhelper.pycode import fix_tkinter_issues_virtualenv, skipif_appveyor


class TestGraphChanges (unittest.TestCase):

@skipif_appveyor("Message: 'generated new fontManager'")
def test_graph_changes(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")

abc = fix_tkinter_issues_virtualenv()
for a in abc:
fLOG(a)

fix_tkinter_issues_virtualenv()
path = os.path.abspath(os.path.split(__file__)[0])
data = os.path.join(path, "data", "changes.txt")
df = pandas.read_csv(data, sep="\t")
fLOG(type(df.loc[0, "date"]), df.loc[0, "date"])
code = produce_code_graph_changes(df)
fLOG(code)

enabled = True
if enabled:
Expand All @@ -50,9 +37,8 @@ def test_graph_changes(self):
'2015-w08', '2015-w09', '2015-w10', '2015-w11', '2015-w12', '2015-w13', '2015-w14', '2015-w15',
'2015-w16', '2015-w17', '2015-w18', '2015-w19', '2015-w20']
plt.close('all')
plt.style.use('ggplot')
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
warnings.simplefilter('ignore', (DeprecationWarning, UserWarning))
_, ax = plt.subplots(nrows=1, ncols=1, figsize=(10, 4))
ax.bar(x, y)
tig = ax.get_xticks()
Expand All @@ -70,10 +56,11 @@ def test_graph_changes(self):
code = code.replace("plt.show", "#plt.show")

obj = compile(code, "", "exec")
try:
exec(obj, globals(), locals())
except Exception as e:
raise Exception(f"unable to run code:\n{code}") from e
if sys.platform != "win32" and __name__ != "__main__":
try:
exec(obj, globals(), locals())
except Exception as e:
raise AssertionError(f"Unable to run code:\n{code}") from e


if __name__ == "__main__":
Expand Down
5 changes: 4 additions & 1 deletion _unittests/ut_helpgen/test_graphviz_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
import unittest

from pyquickhelper.pycode import (
ExtTestCase, skipif_travis, skipif_circleci, get_temp_folder)
ExtTestCase, skipif_travis, skipif_circleci, skipif_appveyor,
get_temp_folder)
from pyquickhelper.helpgen.graphviz_helper import plot_graphviz


class TestHelpGenGraphvizHelper(ExtTestCase):

@skipif_travis('graphviz is not installed')
@skipif_circleci('graphviz is not installed')
@skipif_appveyor("Message: 'generated new fontManager'")
def test_plot_graphviz(self):
dot = dedent("""
digraph D {
Expand All @@ -41,6 +43,7 @@ def test_plot_graphviz(self):

@skipif_travis('graphviz is not installed')
@skipif_circleci('graphviz is not installed')
@skipif_appveyor("Message: 'generated new fontManager'")
def test_plot_graphviz_temp(self):
dot = dedent("""
digraph D {
Expand Down
3 changes: 2 additions & 1 deletion _unittests/ut_helpgen/test_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import unittest

from pyquickhelper.loghelper.flog import fLOG
from pyquickhelper.pycode import get_temp_folder
from pyquickhelper.pycode import get_temp_folder, skipif_appveyor
from pyquickhelper.helpgen.sphinx_main_helper import format_history
from pyquickhelper.helpgen import rst2html

Expand Down Expand Up @@ -135,6 +135,7 @@ def test_format_history_basic(self):

self.assertEqual(content.strip(" \r\n\t"), expect.strip(" \r\n\t"))

@skipif_appveyor("Message: 'generated new fontManager'")
def test_format_history_long(self):
fLOG(
__file__,
Expand Down
3 changes: 2 additions & 1 deletion _unittests/ut_ipythonhelper/test_notebook_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from pyquickhelper.loghelper import fLOG
from pyquickhelper.ipythonhelper import find_notebook_kernel, install_jupyter_kernel, get_notebook_kernel, remove_kernel
from pyquickhelper.pycode import is_travis_or_appveyor
from pyquickhelper.pycode import is_travis_or_appveyor, skipif_appveyor


class TestNotebookKernels(unittest.TestCase):
Expand All @@ -29,6 +29,7 @@ def test_notebook_kernels_list(self):
fLOG(k, type(v), v)
self.assertTrue(kern in res)

@skipif_appveyor("Message: 'Installed kernelspec %s in %s'")
def test_notebook_kernel_install(self):
fLOG(
__file__,
Expand Down
3 changes: 0 additions & 3 deletions _unittests/ut_serverdoc/test_documentation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
@brief test log(time=4s)

"""


import sys
import os
import unittest
from http.server import HTTPServer as skip_

from pyquickhelper.loghelper import fLOG, get_url_content
from pyquickhelper.server import run_doc_server
from pyquickhelper.pycode import skipif_appveyor, ExtTestCase
Expand Down
3 changes: 2 additions & 1 deletion _unittests/ut_serverdoc/test_file_store_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from pyquickhelper.server.filestore_fastapi import (
create_fast_api_app, fast_api_submit, fast_api_query,
fast_api_content, _get_password, _post_request)
from fastapi.testclient import TestClient # pylint: disable=E0401
from pyquickhelper.server.filestore_sqlite import SqlLite3FileStore


Expand All @@ -34,6 +33,7 @@ def test_simple_function2(self):
@skipif_azure("There is no current event loop in thread")
@skipif_circleci("There is no current event loop in thread")
def test_file_store(self):
from fastapi.testclient import TestClient # pylint: disable=E0401
temp = get_temp_folder(__file__, "temp_file_storage_rest")
name = os.path.join(temp, "filestore.db3")
app = create_fast_api_app(name, "BBB")
Expand Down Expand Up @@ -116,6 +116,7 @@ def test_file_store(self):
@skipif_azure("There is no current event loop in thread")
@skipif_circleci("There is no current event loop in thread")
def test_file_store_df(self):
from fastapi.testclient import TestClient # pylint: disable=E0401
temp = get_temp_folder(__file__, "temp_file_storage_rest_df")
name = os.path.join(temp, "filestore.db3")
app = create_fast_api_app(name, "BBB")
Expand Down
5 changes: 4 additions & 1 deletion _unittests/ut_sphinxext/test_bigger_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import os
import unittest
import warnings
from pyquickhelper.pycode import get_temp_folder, ignore_warnings
from pyquickhelper.pycode import (
get_temp_folder, ignore_warnings, skipif_appveyor)
from pyquickhelper.helpgen import rst2html
from pyquickhelper.sphinxext import bigger_role
from docutils.parsers.rst.roles import register_canonical_role
Expand All @@ -18,6 +19,7 @@ def test_post_parse_sn(self):
register_canonical_role("bigger", bigger_role)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_bigger(self):
from docutils import nodes as skip_

Expand Down Expand Up @@ -68,6 +70,7 @@ def test_bigger(self):
f.write(html)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_bigger_inline(self):
from docutils import nodes as skip_

Expand Down
10 changes: 8 additions & 2 deletions _unittests/ut_sphinxext/test_blocref_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import unittest
from docutils.parsers.rst import directives
from pyquickhelper.loghelper.flog import fLOG
from pyquickhelper.pycode import get_temp_folder, ignore_warnings
from pyquickhelper.pycode import (
get_temp_folder, ignore_warnings, skipif_appveyor)
from pyquickhelper.helpgen import rst2html
from pyquickhelper.sphinxext import BlocRef, BlocRefList
from pyquickhelper.sphinxext.sphinx_blocref_extension import blocref_node, visit_blocref_node, depart_blocref_node
from pyquickhelper.sphinxext.sphinx_blocref_extension import (
blocref_node, visit_blocref_node, depart_blocref_node)


class TestBlocRefExtension(unittest.TestCase):
Expand All @@ -20,6 +22,7 @@ def test_post_parse_blocref(self):
directives.register_directive("blocreflist", BlocRefList)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("logging error")
def test_blocref_rst(self):
from docutils import nodes as skip_

Expand Down Expand Up @@ -66,6 +69,7 @@ def test_blocref_rst(self):
raise Exception(html)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_blocref_html(self):
from docutils import nodes as skip_

Expand Down Expand Up @@ -112,6 +116,7 @@ def test_blocref_html(self):
raise Exception(html)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_blocref2(self):
from docutils import nodes as skip_

Expand Down Expand Up @@ -156,6 +161,7 @@ def test_blocref2(self):
raise Exception(html)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_blocreflist(self):
from docutils import nodes as skip_

Expand Down
5 changes: 4 additions & 1 deletion _unittests/ut_sphinxext/test_blog_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import os
import unittest
from docutils.parsers.rst import directives
from pyquickhelper.pycode import get_temp_folder, ignore_warnings
from pyquickhelper.pycode import (
get_temp_folder, ignore_warnings, skipif_appveyor)
from pyquickhelper.helpgen import rst2html
from pyquickhelper.sphinxext.sphinx_blog_extension import (
BlogPostDirective, BlogPostDirectiveAgg,
Expand All @@ -21,6 +22,7 @@ def test_post_parse_blog(self):
directives.register_directive("blogpostagg", BlogPostDirectiveAgg)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_blogpost(self):

from docutils import nodes as skip_
Expand Down Expand Up @@ -71,6 +73,7 @@ def test_blogpost(self):
self.assertIn('after', text)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_blogpost_agg(self):

from docutils import nodes as skip_
Expand Down
8 changes: 7 additions & 1 deletion _unittests/ut_sphinxext/test_blog_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import warnings
from docutils.parsers.rst import directives
from pyquickhelper.loghelper.flog import fLOG
from pyquickhelper.pycode import get_temp_folder, ignore_warnings
from pyquickhelper.pycode import (
get_temp_folder, ignore_warnings, skipif_appveyor)
from pyquickhelper.sphinxext import BlogPost, BlogPostList, BlogPostDirective
from pyquickhelper.helpgen import rst2html
from pyquickhelper.sphinxext import RunPythonDirective
Expand All @@ -32,6 +33,7 @@ def test_post_parse(self):
p.Tag, "post-2015-04-04-anexampleofablogpostincludedinthedocumentation")

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_post_list(self):
# the test will fail if you add a file in data/blog others
# with rst files which is not a blog post
Expand Down Expand Up @@ -60,6 +62,7 @@ def test_post_list(self):
self.assertIn('...', content)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_directive_with_rst2html(self):
path = os.path.abspath(os.path.split(__file__)[0])
file = os.path.join(path, "data", "2015-04-04_first_blogpost.rst")
Expand All @@ -78,6 +81,7 @@ def test_directive_with_rst2html(self):
fLOG("--------------ERRORS\n", html[p1:p2], "------------")

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_docutils(self):
# from https://gist.github.com/mastbaum/2655700
import docutils.core
Expand Down Expand Up @@ -131,6 +135,7 @@ def depart_foo(self, node):
raise Exception(html)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_newdirective_with_rst2html(self):
"""
this test also test the extension runpython
Expand Down Expand Up @@ -181,6 +186,7 @@ def depart_rp_node(self, node):
raise Exception(html)

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("Message: 'Running Sphinx v5.3.0'")
def test_newdirective_with_rst2html_bug(self):
from docutils import nodes

Expand Down
3 changes: 2 additions & 1 deletion _unittests/ut_sphinxext/test_builders_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
import os
import unittest
from pyquickhelper.pycode import ExtTestCase, ignore_warnings
from pyquickhelper.pycode import ExtTestCase, ignore_warnings, skipif_appveyor
from pyquickhelper.sphinxext.sphinx_doctree_builder import DocTreeTranslator
from pyquickhelper.sphinxext.sphinx_latex_builder import EnhancedLaTeXTranslator
from pyquickhelper.sphinxext.sphinx_md_builder import MdTranslator
Expand All @@ -14,6 +14,7 @@
class TestBuildersMissing(ExtTestCase):

@ignore_warnings(PendingDeprecationWarning)
@skipif_appveyor("logging error")
def test_builders_missing(self):
from docutils import nodes as skip_
from sphinx.builders.latex.util import ExtBabel
Expand Down
Loading