Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add tests to mpl toolkits #1422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ install:
script:
- mkdir ../foo
- cd ../foo
- python ../matplotlib/tests.py
- python ../matplotlib/tests.py -sv
6 changes: 6 additions & 0 deletions doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ arguments works from within Python::
import matplotlib
matplotlib.test()

Unlike :file:`tests.py` this does not run any tests of the matplotlib
toolkits. They can however be tested from within Python in a similar
way::

import mpl_toolkits
mpl_toolkits.test()

.. _`nosetest arguments`: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html

Expand Down
Binary file not shown.
47 changes: 47 additions & 0 deletions lib/mpl_toolkits/__init__.py
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')
16 changes: 16 additions & 0 deletions lib/mpl_toolkits/tests/__init__.py
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading