File skip-optional-dependencies-test.patch of Package failed_python-PyLaTeX

Index: PyLaTeX-1.4.1/tests/test_args.py
===================================================================
--- PyLaTeX-1.4.1.orig/tests/test_args.py
+++ PyLaTeX-1.4.1/tests/test_args.py
@@ -8,9 +8,7 @@ still exist. An error from this file mea
 changed.
 """
 
-import numpy as np
-import quantities as pq
-import matplotlib
+import pytest
 
 from pylatex import Document, Section, Math, Tabular, Figure, SubFigure, \
     Package, TikZ, Axis, Plot, Itemize, Enumerate, Description, MultiColumn, \
@@ -25,9 +23,6 @@ from pylatex import Document, Section, M
 from pylatex.utils import escape_latex, fix_filename, dumps_list, bold, \
     italic, verbatim, NoEscape
 
-matplotlib.use('Agg')  # Not to use X server. For TravisCI.
-import matplotlib.pyplot as pyplot  # noqa
-
 
 def test_document():
     geometry_options = {
@@ -76,6 +71,7 @@ def test_hyperref():
 
 
 def test_math():
+    np = pytest.importorskip("numpy")
     math = Math(data=None, inline=False)
     repr(math)
 
@@ -148,6 +144,12 @@ def test_command():
 
 
 def test_graphics():
+    mpl = pytest.importorskip("matplotlib")
+
+    mpl.use('Agg')  # Not to use X server. For TravisCI.
+
+    import matplotlib.pyplot as pyplot  # noqa
+
     f = Figure(data=None, position=None)
 
     f.add_image(filename='', width=r'0.8\textwidth', placement=r'\centering')
@@ -183,6 +185,7 @@ def test_graphics():
 
 
 def test_quantities():
+    pq = pytest.importorskip("quantities")
     # Quantities
     Quantity(quantity=1*pq.kg)
     q = Quantity(quantity=1*pq.kg, format_cb=lambda x: str(int(x)))
Index: PyLaTeX-1.4.1/tests/test_quantities.py
===================================================================
--- PyLaTeX-1.4.1.orig/tests/test_quantities.py
+++ PyLaTeX-1.4.1/tests/test_quantities.py
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
-import quantities as pq
+import pytest
+pq = pytest.importorskip("quantities")
 
 from pylatex.quantities import _dimensionality_to_siunitx, Quantity
 
openSUSE Build Service is sponsored by