forked from python-metar/python-metar
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MNT: Modernize setup.py, beef up test workflow
- Loading branch information
Showing
8 changed files
with
121 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,64 @@ | ||
from nose.tools import * | ||
from metar import station | ||
from metar import graphics | ||
import os | ||
import sys | ||
|
||
import nose.tools as ntools | ||
import datetime as dt | ||
import pandas | ||
import matplotlib | ||
import matplotlib.pyplot as plt | ||
plt.rcParams['text.usetex'] = False | ||
|
||
from metar import station | ||
from metar import graphics | ||
|
||
@ntools.nottest | ||
def getTestFile(filename): | ||
return os.path.join(sys.prefix, 'metar_data', 'test_data', filename) | ||
|
||
class test_graphics(): | ||
def setup(self): | ||
self.freqlist = ['5min', 'hourly', 'daily', 'weekly'] | ||
self.df = pandas.read_csv('test/data_for_graphics_tests.csv', | ||
self.df = pandas.read_csv(getTestFile('data_for_graphics_tests.csv'), | ||
parse_dates=True, index_col=0) | ||
|
||
def teardown(self): | ||
plt.close('all') | ||
|
||
def test_rainClock(self): | ||
'''Confirm that rainClock returns an mpl figure and two axes''' | ||
fig = graphics.rainClock(self.df, fname='test/test_rainClock.png') | ||
assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
fig = graphics.rainClock(self.df, fname=getTestFile('test_rainClock.png')) | ||
ntools.assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
pass | ||
|
||
def test_windRose_kt(self): | ||
'''Confirm that windRose returns an mpl figure and one axis''' | ||
fig = graphics.windRose(self.df, fname='test/test_windRose_kt.png', | ||
fig = graphics.windRose(self.df, fname=getTestFile('test_windRose_kt.png'), | ||
mph=False) | ||
assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
ntools.assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
|
||
def test_windRose_mph(self): | ||
'''Confirm that windRose returns an mpl figure and one axis''' | ||
fig = graphics.windRose(self.df, fname='test/test_windRose_mph.png', | ||
fig = graphics.windRose(self.df, fname=getTestFile('test_windRose_mph.png'), | ||
mph=True) | ||
assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
ntools.assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
|
||
def test_hyetograph(self): | ||
'''Confirm that hyetograph returns an mpl figure and one axis''' | ||
for freq in self.freqlist: | ||
fname = 'test/test_hyetograph_%s.png' % freq | ||
fname = getTestFile('test_hyetograph_%s.png' % freq) | ||
fig = graphics.hyetograph(self.df, freq=freq, fname=fname) | ||
assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
ntools.assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
|
||
def test_psychromograph(self): | ||
'''Confirm that psychromograph returns an mpl figure and one axis''' | ||
for freq in self.freqlist: | ||
fname = 'test/test_psychromograph_%s.png' % freq | ||
fname = getTestFile('test_psychromograph_%s.png' % freq) | ||
fig = graphics.psychromograph(self.df, freq=freq, fname=fname) | ||
assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
ntools.assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
|
||
def test_temperaturePlot(self): | ||
'''Confirm that temperaturePlot returns an mpl figure and one axis''' | ||
for freq in self.freqlist: | ||
fname = 'test/test_temperaturePlot_%s.png' % freq | ||
fname = getTestFile('test_temperaturePlot_%s.png' % freq) | ||
fig = graphics.temperaturePlot(self.df, freq=freq, fname=fname) | ||
assert_true(isinstance(fig, matplotlib.figure.Figure)) | ||
ntools.assert_true(isinstance(fig, matplotlib.figure.Figure)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.