File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4848 env :
4949 CODACY_PROJECT_TOKEN : ${{ secrets.CODACY_PROJECT_TOKEN }}
5050 run : |
51- pytest --cov=markdown_pdf --cov-report xml --cov-report term:skip-covered --durations=5 tests
51+ pytest -m "not external" - -cov=markdown_pdf --cov-report xml --cov-report term:skip-covered --durations=5 tests
5252 if [ "$CODACY_PROJECT_TOKEN" != "" ]; then
5353 python-codacy-coverage -r coverage.xml
5454 fi
8484
8585 - name : pytest
8686 run : |
87- pytest --cov=markdown_pdf --cov-report xml --cov-report term:skip-covered --durations=5 tests
87+ pytest -m "not external" - -cov=markdown_pdf --cov-report xml --cov-report term:skip-covered --durations=5 tests
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pep257:
3636 $(PYTHON ) -m pydocstyle $(SOURCE )
3737
3838tests : flake8 pep257 lint
39- $(PYTEST ) --durations=5 $(TESTS )
39+ $(PYTEST ) -m " not external " - -durations=5 $(TESTS )
4040 $(COVERAGE ) html --skip-covered
4141
4242example :
Original file line number Diff line number Diff line change @@ -54,3 +54,6 @@ filterwarnings = [
5454 ' ignore:builtin type SwigPyObject has no __module__ attribute:DeprecationWarning' ,
5555 ' ignore:builtin type SwigPyPacked has no __module__ attribute:DeprecationWarning' ,
5656]
57+ markers = [
58+ ' external: marks a test as uses external resources'
59+ ]
Original file line number Diff line number Diff line change 1+ """Mermaid plugin tests.
2+
3+ make test T=test_plugins/test_mermaid.py
4+ """
5+ import base64
6+ import requests
7+ import pytest
8+
9+ from . import TestPlugin
10+
11+ MERMAID_CODE = """
12+ stateDiagram-v2
13+ [*] --> Still
14+ Still --> [*]
15+
16+ Still --> Moving
17+ Moving --> Still
18+ Moving --> Crash
19+ Crash --> [*]
20+ """
21+
22+
23+ class TesMermaid (TestPlugin ):
24+ """Mermaid content."""
25+
26+ @pytest .mark .external
27+ def test_www (self ):
28+ """Make image for mermaid content."""
29+ # https://github.com/ouhammmourachid/mermaid-py
30+ response = requests .get (
31+ "https://mermaid.ink/img/{}" .format (
32+ # Use URL-safe base64 encoding (replaces + with -, / with _)
33+ base64 .urlsafe_b64encode (MERMAID_CODE .encode ("utf-8" )).decode ("ascii" ),
34+ ),
35+ params = {"format" : "png" },
36+ timeout = 5
37+ )
38+ assert len (response .content ) > 0
39+ with open (self .build ("test_mermaid.png" ), "wb" ) as out :
40+ out .write (response .content )
Original file line number Diff line number Diff line change 1717class TesPlantuml (TestPlugin ):
1818 """Plantuml content."""
1919
20- def _test_www (self ):
20+ @pytest .mark .external
21+ def test_www (self ):
2122 """Make image for plantuml content."""
2223 server = PlantUML (url = 'http://www.plantuml.com/plantuml/img/' )
2324 image = server .processes (UML_CODE )
You can’t perform that action at this time.
0 commit comments