Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

WIP: issue #5325, convert from nose to pytest #5405

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 174 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
4c39e53
ENH: use pytest instead of nose.
pizzathief Oct 31, 2015
f10a36b
pytest.raises(), not pytest.raise()
pizzathief Nov 4, 2015
c17005b
pytest.raises() calls needed some massaging
pizzathief Nov 4, 2015
1a75b75
replace nose with pytest in INSTALL
pizzathief Nov 4, 2015
b123ed7
altering more assert_equal calls.
pizzathief Nov 4, 2015
5f433fb
fixing up problems with assert, and the use of messages.
pizzathief Nov 5, 2015
cfb8d71
flake8 failures
pizzathief Nov 5, 2015
89d3366
flake8 doesn't like blank lines at ends of files.
pizzathief Nov 5, 2015
887e482
flake8 fixes
pizzathief Nov 5, 2015
8f16316
fixed syntax errors
pizzathief Nov 5, 2015
b56297f
just have it on one line
pizzathief Nov 5, 2015
df4e413
fix errors highlighted in travis CI logs
pizzathief Nov 5, 2015
defa65d
fixing reported test failures, reported by pytest on travis.
pizzathief Nov 5, 2015
b8b3909
fixing pytest failures. Interesting that assert can't seem to handle
pizzathief Nov 5, 2015
5fd4351
fixing syntax failures
pizzathief Nov 5, 2015
47c968b
Force travis to install pytest, and plugins
pizzathief Nov 5, 2015
1b509c1
get travis to run py.test instead of nose.
pizzathief Nov 6, 2015
432e9e8
small pep8 fix to force travis to build
pizzathief Nov 6, 2015
60b038c
lets see if indenting a comment fixes the problem
pizzathief Nov 6, 2015
2984d44
give py.test the install location of the module, rather
pizzathief Nov 7, 2015
e27451d
forgot to remove the bad py.test call.
pizzathief Nov 7, 2015
784fdf8
force pytest-pep8 to ignore the pep8 warnings that
pizzathief Nov 7, 2015
f035db7
temporarily adding more items to be ignored by pep8,
pizzathief Nov 7, 2015
1e7b62c
trying out --pyargs as requested, also removing pep checks,
pizzathief Nov 7, 2015
56d99ed
tests.py should now act more like the old nose version did,
pizzathief Nov 8, 2015
7d38aa3
lets try the 'gdb python tests.py' method again.
pizzathief Nov 8, 2015
7bbc04a
the switches that nose needed , make pytest fail, so lets
pizzathief Nov 8, 2015
05da48a
pytest.main doesn't like --pyargs now? it used to..
pizzathief Nov 9, 2015
98b1e69
Adding in all tests to the list, including argv[1:]
pizzathief Nov 13, 2015
6853e71
seems --processes=2 and --process-timeout=300
pizzathief Nov 13, 2015
105a15d
replace assert_raises with pytest.raises
pizzathief Nov 13, 2015
5482cc7
another assert_raises to replace with pytest.raises
pizzathief Nov 13, 2015
4a8caad
replace assert_raises with pytest.raises
pizzathief Nov 13, 2015
8985c35
Fixing errors that appear before testing starts
pizzathief Nov 13, 2015
789f864
replaced a nose function for known failing tests
pizzathief Nov 13, 2015
4900796
updating basic tests that are know to fail with
pizzathief Nov 14, 2015
0633576
add the ability to only run pep8 tests. remove commented out means
pizzathief Nov 18, 2015
47ef9f0
ass civerage report as standard
pizzathief Nov 18, 2015
2a7637c
no need for the nose pep8 tests, so remove from tests.py
pizzathief Nov 18, 2015
08ae5ef
pep8 and non-pep8 tests act better now. taking out
pizzathief Nov 25, 2015
bd0c061
remove more of the nose infrastructure
pizzathief Nov 27, 2015
42e7ae1
Pass the exit code of pytest.main back to the shell.
pizzathief Dec 13, 2015
86820be
replace nose decorator with pytest code.
pizzathief Dec 13, 2015
37c67c2
whoops, deleted an 'a' from a variable while doing
pizzathief Dec 13, 2015
84359ac
fix up a bunch of pytest.raises calls.
pizzathief Dec 13, 2015
c76bef9
found 'assert_less' calls to replace
pizzathief Dec 13, 2015
2e58461
found a space and comma char that had attempted an escape of the faci…
pizzathief Dec 13, 2015
517b232
found some assert_equal statements to convert.
pizzathief Dec 13, 2015
9aee1fc
converted assert_raises calls to pytest.raises.
pizzathief Dec 13, 2015
91f3032
more assert_raises calls to replace
pizzathief Dec 13, 2015
86f7264
Thanks to QuLogic , using decorator form of pytest.raises for
pizzathief Dec 13, 2015
f7e7401
more conversions of pytest.raises to use 'with' instead.
pizzathief Dec 13, 2015
6f935ce
change nose method for calling test class methods.
pizzathief Dec 14, 2015
72ddc43
fixing pep8 failures.
pizzathief Dec 14, 2015
2d71f19
more pep8 fixes.
pizzathief Dec 14, 2015
571fbbd
another testing class that needed changes for pytest.
pizzathief Dec 14, 2015
50b0e0a
more pep8 failures to hide under the rug.
pizzathief Dec 14, 2015
4408d10
another pytest.raises to fix.
pizzathief Dec 14, 2015
4e87b72
lets try not comparing the equivilance of empty dicts, but rather
pizzathief Dec 14, 2015
6d3bb58
if commenting out the nose pep8 functions work, then they
pizzathief Dec 14, 2015
4bfbf26
pep8 fixes.
pizzathief Dec 14, 2015
1ffc9c2
fix typos found QuLogic
pizzathief Dec 14, 2015
389ebc3
removing (and moving) import code in tests.py
pizzathief Dec 15, 2015
1f1c2a6
replacing new nose calls with plain asserts
pizzathief Dec 15, 2015
01df455
exclude files from pep8 checking
pizzathief Dec 15, 2015
bb3ab51
add support for running a single test module, instead of all of them
pizzathief Dec 21, 2015
73e9383
The "_name.py" files in exclude_files might need globbing to
pizzathief Dec 28, 2015
5f3255b
pep8 failures
pizzathief Dec 28, 2015
f4826c3
pep8 was demanding that lambdas be replaced with proper functions.
pizzathief Dec 28, 2015
08ce37b
This is hopefully an acceptable solution to the problem with
pizzathief Dec 28, 2015
f705680
pep8 failures
pizzathief Dec 28, 2015
9aac515
remove assert_not_equal
pizzathief Dec 28, 2015
4a62ad9
lets try '--ignore'ing the numpy tests dir
pizzathief Dec 31, 2015
df2ebeb
Don't code at night on holidays with bad specs.
pizzathief Dec 31, 2015
1e12273
try norecursedirs to get pytest to stop looking in numpy
pizzathief Jan 1, 2016
47e0c4b
found cases of 'import nose' , and also, use of
pizzathief Jan 2, 2016
d04ab5c
needed to specify 'reason=' for xfail to work
pizzathief Jan 2, 2016
57b2f17
need to specify a 'reason=' to use pytest.maek.xfail
pizzathief Jan 2, 2016
636728f
don't need knownfailureif
pizzathief Jan 2, 2016
b0a342d
pytest xfail needs a 'reason'
pizzathief Jan 2, 2016
78587c1
fixing up small pytest issues
pizzathief Jan 2, 2016
09e559a
don't need the nose make_decorator function any more.
pizzathief Jan 4, 2016
8c3f2f1
to please the pep8 gods, we sacrifice this line break.
pizzathief Jan 4, 2016
62983b5
replace a knownfailureif call, and fix up pytest xfail calls
pizzathief Jan 4, 2016
e83807f
make_decorator seems to be described here.
pizzathief Jan 4, 2016
22ee978
resolve the oeo8 allergy to blank lines,
pizzathief Jan 4, 2016
ea7c57f
fix up xfail calls
pizzathief Jan 4, 2016
3008a22
another zfail reason fix
pizzathief Jan 4, 2016
49d2315
typo
pizzathief Jan 4, 2016
a1f31a8
don't import from nose , and don't need knownfailure
pizzathief Jan 5, 2016
e812aac
remove knownfailureif reference
pizzathief Jan 5, 2016
4fff146
An attempt to make a image_comparison decorator that doesn't fail
pizzathief Jan 8, 2016
738da3e
fix up indentation for import
pizzathief Jan 8, 2016
da60028
another fix for indentation. kinda non-dry'y
pizzathief Jan 8, 2016
726cc92
removed mentions of 'import nose'
pizzathief Jan 11, 2016
f17a2db
more nose lines to change
pizzathief Jan 11, 2016
683546e
regex assertions to convert
pizzathief Jan 11, 2016
63eae4b
replaced nose.assert_almost_equal with the numpy one, but
pizzathief Jan 11, 2016
6c46f42
basic nose replacement stuff
pizzathief Jan 11, 2016
c4a824e
fix up test failures caused through rebase
pizzathief Jan 14, 2016
ac14548
add in the ability to filter out numpy files from consideration
pizzathief Jan 15, 2016
3f45e42
fix up test_mlab.py raises and nose import lines
pizzathief Jan 17, 2016
38c29c6
fix test_apply_window_*D* function calls in test_mlab.py
pizzathief Jan 17, 2016
fc4e025
fix test_LogLocator in test_ticker.py
pizzathief Jan 17, 2016
ade1890
fix lack of pytest import in test_transforms.py
pizzathief Jan 17, 2016
1cbd24a
remove __name__ == '__main__' from many test files
pizzathief Jan 17, 2016
373fa15
PEP8 E301 in test_docstring_addition
pizzathief Jan 17, 2016
ca9828a
PEP8 E302 in test_transforms.py, test_transformed_path
pizzathief Jan 17, 2016
fa1e601
PEP8 E261 in test_mathtext.py, math_tests[]
pizzathief Jan 17, 2016
534ab6f
PEP8 E712 in test_figure.py, test_fignum_exists
pizzathief Jan 18, 2016
db2d85b
PEP8 E302 test_dviread.py around setup_PsfontsMap
pizzathief Jan 18, 2016
c4ea6d4
PEP8 E712 in test_axes.py
pizzathief Jan 18, 2016
a2291a1
PEP8 E712 in test_artist.py , test_remove
pizzathief Jan 18, 2016
65b42bd
PEP8 W293 in test_labeled_data_unpacking.py, test_docstring_addition
pizzathief Jan 18, 2016
8a22e2a
fix bad pytest raises calls in test_triangulation.py
pizzathief Jan 18, 2016
6ed71fa
fix bad pytest.raises calls in test_cbook.py test_step_fails
pizzathief Jan 18, 2016
f78c075
fix bad assert calls in test_pickle.py , test_transform
pizzathief Jan 18, 2016
1d7b37c
fix bad pytest.raises calls in test_colors.py, test_colors_no_float
pizzathief Jan 18, 2016
90bbe25
fix pytest.raises call in test_colors.py test_cmap_and_norm_from_leve…
pizzathief Jan 18, 2016
ee30e10
fix rebase omission, test_transform in test_pickle.py
pizzathief Jan 18, 2016
35520a4
fix user searh, not match in test_labeled_data_unpacking, test_docstr…
pizzathief Jan 18, 2016
b3c7dda
fix test_invalid_input_forms in test_cycles.py
pizzathief Jan 18, 2016
331428f
fix nose skiptest references, test_axes.py
pizzathief Jan 18, 2016
ea38ba6
remove nose import references, many files
pizzathief Jan 18, 2016
2cb6b8c
PEP8 E302 at test_gridspec.py
pizzathief Jan 18, 2016
accbcf2
doc convert nose docs to pytest, testing.rst
pizzathief Jan 19, 2016
a4ddff3
fix remove nose install from travis
pizzathief Jan 19, 2016
bd5828f
fix syntax error (newline) in testing.rst
pizzathief Jan 19, 2016
930c529
fix numpy pytest errors. don't put pylab in default namespace
pizzathief Jan 19, 2016
ae9715c
ENH: use pytest instead of nose.
pizzathief Oct 31, 2015
edabe74
pytest.raises(), not pytest.raise()
pizzathief Nov 4, 2015
23d6fae
pytest.raises() calls needed some massaging
pizzathief Nov 4, 2015
f27909a
fixing up problems with assert, and the use of messages.
pizzathief Nov 5, 2015
a023347
fix errors highlighted in travis CI logs
pizzathief Nov 5, 2015
dd8111b
fixing pytest failures. Interesting that assert can't seem to handle
pizzathief Nov 5, 2015
9f53f57
fixing syntax failures
pizzathief Nov 5, 2015
eefe67d
force pytest-pep8 to ignore the pep8 warnings that
pizzathief Nov 7, 2015
2661e32
the switches that nose needed , make pytest fail, so lets
pizzathief Nov 8, 2015
f404baa
another assert_raises to replace with pytest.raises
pizzathief Nov 13, 2015
53457e9
replaced a nose function for known failing tests
pizzathief Nov 13, 2015
0f9fae8
remove more of the nose infrastructure
pizzathief Nov 27, 2015
cd961cc
fix up a bunch of pytest.raises calls.
pizzathief Dec 13, 2015
de69032
converted assert_raises calls to pytest.raises.
pizzathief Dec 13, 2015
42185f8
fixing pep8 failures.
pizzathief Dec 14, 2015
cd81fbf
more pep8 failures to hide under the rug.
pizzathief Dec 14, 2015
523bb86
if commenting out the nose pep8 functions work, then they
pizzathief Dec 14, 2015
859f8d5
removing (and moving) import code in tests.py
pizzathief Dec 15, 2015
ad48b37
pep8 failures
pizzathief Dec 28, 2015
9a0b134
try norecursedirs to get pytest to stop looking in numpy
pizzathief Jan 1, 2016
23cee6a
found cases of 'import nose' , and also, use of
pizzathief Jan 2, 2016
c59a7b0
don't need the nose make_decorator function any more.
pizzathief Jan 4, 2016
43fd3e2
make_decorator seems to be described here.
pizzathief Jan 4, 2016
108522a
An attempt to make a image_comparison decorator that doesn't fail
pizzathief Jan 8, 2016
90221b9
fix up indentation for import
pizzathief Jan 8, 2016
6f74d88
another fix for indentation. kinda non-dry'y
pizzathief Jan 8, 2016
0ba7323
removed mentions of 'import nose'
pizzathief Jan 11, 2016
39612f6
fix up test failures caused through rebase
pizzathief Jan 14, 2016
336d1eb
remove __name__ == '__main__' from many test files
pizzathief Jan 17, 2016
7d9fdf6
fix test_invalid_input_forms in test_cycles.py
pizzathief Jan 18, 2016
606907b
fix nose skiptest references, test_axes.py
pizzathief Jan 18, 2016
db5f5e5
fix numpy pytest errors. don't put pylab in default namespace
pizzathief Jan 19, 2016
37418d8
PEP8 E502 at test_simplification.py, test_fft_peaks
pizzathief Jan 19, 2016
01b9215
remove @cleanup operator from test_complete. Its causing a pytest
pizzathief Jan 21, 2016
b9c0ee7
PEP8 E302 around teardown_PsfontsMap, test_dviread.py
pizzathief Jan 22, 2016
e002e48
fix lack of _func error in image_comparison_2, decorators.py
pizzathief Jan 22, 2016
25f77bc
fix assert_raises call in test_valid_linestyles, test_lines.py
pizzathief Jan 22, 2016
1996513
fix syntax error (another newline) in testing.rst, rst files
pizzathief Jan 22, 2016
07313db
doc lets remove pytest targets in rst for now
pizzathief Jan 22, 2016
280be1b
convert pytest.raises(error,f,x,y) calls to with pytest.raises
pizzathief Jan 23, 2016
a135e56
fix test_positional_parameter_names_as_function , seems getting a
pizzathief Jan 23, 2016
e52e0fc
PEP8 E201 in test_stride_windows_0D_ValueError, test_mlab.py
pizzathief Jan 23, 2016
d2f4e6b
as requested, push a simple change to test appveyor
pizzathief Feb 8, 2016
bf19dad
trying to get pytest to recognise dynamically created test
pizzathief Feb 10, 2016
f111193
make tests.py handle single modules better
pizzathief Feb 10, 2016
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
Prev Previous commit
Next Next commit
removed mentions of 'import nose'
  • Loading branch information
pizzathief committed Jan 21, 2016
commit 726cc928394a5878b06b7fd271ffb3e54df50223
Empty file added 0 conftest.py
Empty file.
1 change: 0 additions & 1 deletion 1 lib/matplotlib/tests/test_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import tempfile
import numpy as np
from numpy.testing import assert_equal
from nose import with_setup
from matplotlib import pyplot as plt
from matplotlib import animation
from matplotlib.testing.decorators import cleanup
Expand Down
15 changes: 7 additions & 8 deletions 15 lib/matplotlib/tests/test_backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
import shutil

import numpy as np
import nose
from nose.plugins.skip import SkipTest

import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.compat import subprocess
from matplotlib.testing.compare import compare_images, ImageComparisonFailure
from matplotlib.testing.decorators import _image_directories, switch_backend
import pytest


baseline_dir, result_dir = _image_directories(lambda: 'dummy func')
Expand Down Expand Up @@ -83,7 +82,7 @@ def create_figure():
@switch_backend('pgf')
def test_xelatex():
if not check_for('xelatex'):
raise SkipTest('xelatex + pgf is required')
raise pytest.skip('xelatex + pgf is required')

rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
Expand All @@ -96,7 +95,7 @@ def test_xelatex():
@switch_backend('pgf')
def test_pdflatex():
if not check_for('pdflatex'):
raise SkipTest('pdflatex + pgf is required')
raise pytest.skip('pdflatex + pgf is required')

rc_pdflatex = {'font.family': 'serif',
'pgf.rcfonts': False,
Expand All @@ -112,7 +111,7 @@ def test_pdflatex():
@switch_backend('pgf')
def test_rcupdate():
if not check_for('xelatex') or not check_for('pdflatex'):
raise SkipTest('xelatex and pdflatex + pgf required')
raise pytest.skip('xelatex and pdflatex + pgf required')

rc_sets = []
rc_sets.append({'font.family': 'sans-serif',
Expand Down Expand Up @@ -141,7 +140,7 @@ def test_rcupdate():
@switch_backend('pgf')
def test_pathclip():
if not check_for('xelatex'):
raise SkipTest('xelatex + pgf is required')
raise pytest.skip('xelatex + pgf is required')

rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
Expand All @@ -159,7 +158,7 @@ def test_pathclip():
@switch_backend('pgf')
def test_mixedmode():
if not check_for('xelatex'):
raise SkipTest('xelatex + pgf is required')
raise pytest.skip('xelatex + pgf is required')

rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
Expand All @@ -175,7 +174,7 @@ def test_mixedmode():
@switch_backend('pgf')
def test_bbox_inches():
if not check_for('xelatex'):
raise SkipTest('xelatex + pgf is required')
raise pytest.skip('xelatex + pgf is required')

rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
Expand Down
7 changes: 2 additions & 5 deletions 7 lib/matplotlib/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

from fnmatch import fnmatch
import os

from nose.tools import assert_equal
from nose.plugins.skip import SkipTest
import pytest
# import pytest

try:
import pep8
Expand Down Expand Up @@ -102,7 +99,7 @@ def get_file_results(self):
# """
#
# if not HAS_PEP8:
# raise SkipTest('The pep8 tool is required for this test')
# raise pytest.skip('The pep8 tool is required for this test')
#
# # to get a list of bad files, rather than the specific errors, add
# # "reporter=pep8.FileReport" to the StyleGuide constructor.
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/matplotlib/tests/test_compare_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import shutil

from nose.tools import assert_equal, assert_not_equal, assert_almost_equal
from numpy.testing import assert_almost_equal

from matplotlib.testing.compare import compare_images
from matplotlib.testing.decorators import _image_directories
Expand Down
6 changes: 3 additions & 3 deletions 6 lib/matplotlib/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from matplotlib import mlab
from matplotlib.testing.decorators import cleanup, image_comparison
from matplotlib import pyplot as plt
from nose.tools import assert_equal, assert_raises
import pytest
import warnings

import re
Expand Down Expand Up @@ -284,12 +284,12 @@ def test_contourf_decreasing_levels():
# github issue 5477.
z = [[0.1, 0.3], [0.5, 0.7]]
plt.figure()
assert_raises(ValueError, plt.contourf, z, [1.0, 0.0])
pytest.raises(ValueError, plt.contourf, z, [1.0, 0.0])
# Legacy contouring algorithm gives a warning rather than raising an error,
# plus a DeprecationWarning.
with warnings.catch_warnings(record=True) as w:
plt.contourf(z, [1.0, 0.0], corner_mask='legacy')
assert_equal(len(w), 2)
assert len(w) == 2


@cleanup
Expand Down
23 changes: 13 additions & 10 deletions 23 lib/matplotlib/tests/test_cycles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from matplotlib.cbook import MatplotlibDeprecationWarning
import matplotlib.pyplot as plt
import numpy as np
from nose.tools import assert_raises

import pytest
from cycler import cycler


Expand Down Expand Up @@ -173,14 +172,18 @@ def test_cycle_reset():
@cleanup
def test_invalid_input_forms():
fig, ax = plt.subplots()
assert_raises((TypeError, ValueError), ax.set_prop_cycle, 1)
assert_raises((TypeError, ValueError), ax.set_prop_cycle, [1, 2])
assert_raises((TypeError, ValueError), ax.set_prop_cycle, 'color', 'fish')
assert_raises((TypeError, ValueError), ax.set_prop_cycle, 'linewidth', 1)
assert_raises((TypeError, ValueError), ax.set_prop_cycle,
'linewidth', {'1': 1, '2': 2})
assert_raises((TypeError, ValueError), ax.set_prop_cycle,
linewidth=1, color='r')
with pytest.raises(TypeError, ValueError):
ax.set_prop_cycle(1)
with pytest.raises(TypeError, ValueError):
ax.set_prop_cycle([1, 2])
with pytest.raises(TypeError, ValueError):
ax.set_prop_cycle('color', 'fish')
with pytest.raises(TypeError, ValueError):
ax.set_prop_cycle('linewidth', 1)
with pytest.raises(TypeError, ValueError):
ax.set_prop_cycle('linewidth', {'1': 1, '2': 2})
with pytest.raises(TypeError, ValueError):
ax.set_prop_cycle(linewidth=1, color='r')


if __name__ == '__main__':
Expand Down
16 changes: 8 additions & 8 deletions 16 lib/matplotlib/tests/test_dviread.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@

from matplotlib.externals import six

from nose.tools import assert_equal, with_setup
import matplotlib.dviread as dr
import os.path
import json


original_find_tex_file = dr.find_tex_file


def setup_PsfontsMap():
dr.find_tex_file = lambda x: x


def teardown_PsfontsMap():
dr.find_tex_file = original_find_tex_file

@pytest.fixture()
def setup_PsfontsMap(request):
dr.find_tex_file = lambda x: x
def fin():
teardown_PsfontsMap()
request.addfinalizer(fin)


@with_setup(setup_PsfontsMap, teardown_PsfontsMap)
def test_PsfontsMap():
def test_PsfontsMap(setup_PsfontsMap):
filename = os.path.join(
os.path.dirname(__file__),
'baseline_images', 'dviread', 'test.map')
Expand Down
4 changes: 1 addition & 3 deletions 4 lib/matplotlib/tests/test_labeled_data_unpacking.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import (absolute_import, division, print_function)

from nose.tools import (assert_raises, assert_equal)
from nose.plugins.skip import SkipTest
import pytest

try:
Expand Down Expand Up @@ -192,7 +190,7 @@ def test_function_call_with_pandas_data():
try:
import pandas as pd
except ImportError:
raise SkipTest("Pandas not installed")
raise pytest.skip("Pandas not installed")

data = pd.DataFrame({"a": [1, 2], "b": [8, 9], "w": ["NOT", "NOT"]})

Expand Down
3 changes: 1 addition & 2 deletions 3 lib/matplotlib/tests/test_mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from numpy.testing import assert_allclose, assert_array_equal
import numpy.ma.testutils as matest
import numpy as np
# from nose.tools import (assert_equal, assert_almost_equal, assert_not_equal,
# assert_true, assert_raises)
from numpy.testing import assert_almost_equal

import matplotlib.mlab as mlab
import matplotlib.cbook as cbook
Expand Down
13 changes: 5 additions & 8 deletions 13 lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
from matplotlib.tests import assert_str_equal
from matplotlib.testing.decorators import cleanup
import matplotlib.colors as mcolors
# from nose.tools import assert_true, assert_raises, assert_equal
# from nose.plugins.skip import SkipTest
# import nose
from itertools import chain
import numpy as np
from matplotlib.rcsetup import (validate_bool_maybe_none,
Expand Down Expand Up @@ -116,7 +113,7 @@ def test_RcParams_class():

def test_rcparams_update():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
raise pytest.skip("assert_raises as context manager "
"not supported with Python < 2.7")
rc = mpl.RcParams({'figure.figsize': (3.5, 42)})
bad_dict = {'figure.figsize': (3.5, 42, 1)}
Expand All @@ -132,7 +129,7 @@ def test_rcparams_update():

def test_rcparams_init():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
raise pytest.skip("assert_raises as context manager "
"not supported with Python < 2.7")
with pytest.raises(ValueError):
with warnings.catch_warnings():
Expand Down Expand Up @@ -178,7 +175,7 @@ def test_Bug_2543_newer_python():
# only split from above because of the usage of assert_raises
# as a context manager, which only works in 2.7 and above
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest(
raise pytest.skip(
"assert_raises as context manager not supported with Python < 2.7")
from matplotlib.rcsetup import validate_bool_maybe_none, validate_bool
with pytest.raises(ValueError):
Expand Down Expand Up @@ -259,7 +256,7 @@ def _validation_test_helper(validator, arg, target):

def _validation_fail_helper(validator, arg, exception_type):
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager not "
raise pytest.skip("assert_raises as context manager not "
"supported with Python < 2.7")
pytest.raises(exception_type,validator, arg)

Expand Down Expand Up @@ -400,7 +397,7 @@ def test_rcparams_reset_after_fail():
if sys.version_info[:2] >= (2, 7):
from collections import OrderedDict
else:
raise SkipTest("Test can only be run in Python >= 2.7"
raise pytest.skip("Test can only be run in Python >= 2.7"
" as it requires OrderedDict")

with mpl.rc_context(rc={'text.usetex': False}):
Expand Down
8 changes: 2 additions & 6 deletions 8 lib/matplotlib/tests/test_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
import tempfile
from contextlib import contextmanager

from nose import SkipTest
from nose.tools import assert_raises
from nose.plugins.attrib import attr

import matplotlib as mpl
from matplotlib import style
from matplotlib.style.core import USER_LIBRARY_PATHS, STYLE_EXTENSION
Expand Down Expand Up @@ -58,7 +54,7 @@ def test_use():
assert mpl.rcParams[PARAM] == VALUE


@attr('network')
@pytest.mark.network
def test_use_url():
with temp_style('test', DUMMY_SETTINGS):
with style.context('https://gist.github.com/adrn/6590261/raw'):
Expand Down Expand Up @@ -126,7 +122,7 @@ def test_context_with_badparam():
from collections import OrderedDict
else:
m = "Test can only be run in Python >= 2.7 as it requires OrderedDict"
raise SkipTest(m)
raise pytest.skip(m)

original_value = 'gray'
other_value = 'blue'
Expand Down
4 changes: 1 addition & 3 deletions 4 lib/matplotlib/tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import numpy as np
from numpy.testing import assert_almost_equal
from nose.tools import eq_, assert_raises
from nose.plugins.skip import SkipTest

from matplotlib.transforms import Bbox
import matplotlib
Expand Down Expand Up @@ -290,7 +288,7 @@ def test_get_rotation_raises():
from matplotlib import text
import sys
if sys.version_info[:2] < (2, 7):
raise SkipTest("assert_raises as context manager "
raise pytest.skip("assert_raises as context manager "
"not supported with Python < 2.7")
pytest.raises(ValueError, text.get_rotation, 'hozirontal')

Expand Down
5 changes: 2 additions & 3 deletions 5 lib/matplotlib/tests/test_type1font.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from matplotlib.externals import six

from nose.tools import assert_equal, assert_in
import matplotlib.type1font as t1f
import os.path
import difflib
Expand Down Expand Up @@ -41,7 +40,7 @@ def test_Type1Font():
# Alters ItalicAngle
'- /ItalicAngle 0 def',
'+ /ItalicAngle -45.0 def'):
assert_in(line, diff, 'diff to slanted font must contain %s' % line)
assert line in diff, 'diff to slanted font must contain %s' % line

diff = list(differ.compare(font.parts[0].decode('latin-1').splitlines(),
condensed.parts[0].decode('latin-1').splitlines()))
Expand All @@ -55,4 +54,4 @@ def test_Type1Font():
# Alters FontMatrix
'- /FontMatrix [0.001 0 0 0.001 0 0 ]readonly def',
'+ /FontMatrix [0.0005 0.0 0.0 0.001 0.0 0.0]readonly def'):
assert_in(line, diff, 'diff to condensed font must contain %s' % line)
assert line in diff, 'diff to condensed font must contain %s' % line
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.