Skip to content

Commit

Permalink
Fix matplotlib display error
Browse files Browse the repository at this point in the history
  • Loading branch information
ljvmiranda921 committed May 17, 2018
1 parent 8d72e11 commit a62f17b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions tests/utils/environments/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
"""Fixtures for tests"""

# Import modules
import os
import pytest
import numpy as np
from mock import Mock
import matplotlib as mpl

if os.environ.get('DISPLAY','') == '':
mpl.use('Agg')

# Import from package
from pyswarms.single import GlobalBestPSO
Expand Down
6 changes: 3 additions & 3 deletions tests/utils/environments/test_plot_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import pytest
import numpy as np
import matplotlib as mpl
from matplotlib.axes._subplots import SubplotBase
from matplotlib.animation import FuncAnimation

# Fix for display
if os.environ.get('DISPLAY','') == '':
mpl.use('Agg')

from matplotlib.axes._subplots import SubplotBase
from matplotlib.animation import FuncAnimation

# Import from package
from pyswarms.utils.environments import PlotEnvironment
from pyswarms.utils.functions.single_obj import sphere_func
Expand Down

0 comments on commit a62f17b

Please sign in to comment.