Refactored mpl.use('agg') from the tests __init__

replaced with a swap of
plt.show with an empty lambda
This commit is contained in:
Colin Talbert 2016-06-07 08:45:03 -06:00
parent e4f7ec8526
commit 2bd1bd9aed
5 changed files with 23 additions and 6 deletions

View File

@ -1,6 +0,0 @@
#
try:
import matplotlib as mpl
mpl.use('agg')
except ImportError:
pass

View File

@ -4,6 +4,13 @@ import sys
import numpy as np
import pytest
try:
import matplotlib as mpl
mpl.use('agg')
import matplotlib.pyplot as plt
except ImportError:
plt = None
from affine import Affine
import rasterio
from rasterio.enums import MaskFlags

View File

@ -15,6 +15,13 @@ from rasterio import (
get_data_window, window_intersection, window_union, windows_intersect
)
try:
import matplotlib as mpl
mpl.use('agg')
import matplotlib.pyplot as plt
plt.show = lambda :None
except:
pass
DATA_WINDOW = ((3, 5), (2, 6))

View File

@ -2,6 +2,12 @@ import numpy as np
import rasterio
try:
import matplotlib as mpl
mpl.use('agg')
except:
pass
def test_reshape():
with rasterio.open('tests/data/RGB.byte.tif') as src:
im_data = rasterio.plot.reshape_as_image(src.read())

View File

@ -1,7 +1,10 @@
import numpy as np
try:
import matplotlib as mpl
mpl.use('agg')
import matplotlib.pyplot as plt
plt.show = lambda :None
except ImportError:
plt = None