forked from matplotlib/matplotlib
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add infrastructure for testing of mpl toolkits and a single test to d…
…emonstrate. "python tests.py" runs all tests from mpl and the toolkits. mpl_toolkits.test() runs tests of the toolkits only.
- Loading branch information
1 parent
ecb4802
commit ec0fd15
Showing
8 changed files
with
1,137 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,51 @@ | ||
import sys | ||
from matplotlib import Verbose | ||
from matplotlib import rcParams | ||
from matplotlib import __version__ | ||
from matplotlib import use | ||
|
||
verbose = Verbose() | ||
|
||
try: | ||
__import__('pkg_resources').declare_namespace(__name__) | ||
except ImportError: | ||
pass # must not have setuptools | ||
|
||
toolkits_test_modules = [ | ||
'mpl_toolkits.tests.test_axesgrid1', | ||
] | ||
|
||
def test(verbosity=1): | ||
"""run the matplotlib test suite""" | ||
old_backend = rcParams['backend'] | ||
try: | ||
use('agg') | ||
import nose | ||
import nose.plugins.builtin | ||
from matplotlib.testing.noseclasses import KnownFailure | ||
from nose.plugins.manager import PluginManager | ||
|
||
# store the old values before overriding | ||
plugins = [] | ||
plugins.append( KnownFailure() ) | ||
plugins.extend( [plugin() for plugin in nose.plugins.builtin.plugins] ) | ||
|
||
manager = PluginManager(plugins = plugins) | ||
config = nose.config.Config(verbosity = verbosity, plugins = manager) | ||
|
||
success = nose.run( defaultTest = toolkits_test_modules, | ||
config=config, | ||
) | ||
finally: | ||
if old_backend.lower() != 'agg': | ||
use(old_backend) | ||
|
||
return success | ||
|
||
test.__test__ = False # nose: this function is not a test | ||
|
||
verbose.report('matplotlib version %s'%__version__) | ||
verbose.report('verbose.level %s'%verbose.level) | ||
verbose.report('interactive is %s'%rcParams['interactive']) | ||
verbose.report('platform is %s'%sys.platform) | ||
verbose.report('loaded modules: %s'%sys.modules.iterkeys(), 'debug') |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from __future__ import print_function | ||
from matplotlib import rcParams, rcdefaults, use | ||
|
||
_multiprocess_can_split_ = True | ||
|
||
def setup(): | ||
use('Agg', warn=False) # use Agg backend for these tests | ||
|
||
# These settings *must* be hardcoded for running the comparison | ||
# tests and are not necessarily the default values as specified in | ||
# rcsetup.py | ||
rcdefaults() # Start with all defaults | ||
rcParams['font.family'] = 'Bitstream Vera Sans' | ||
rcParams['text.hinting'] = False | ||
rcParams['text.hinting_factor'] = 8 | ||
rcParams['text.antialiased'] = False |
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.