8000 Privatize testing.copy_metadata. · matplotlib/matplotlib@8acd57d · GitHub
[go: up one dir, main page]

Skip to content

Commit 8acd57d

Browse files
committed
Privatize testing.copy_metadata.
Never been in a release and we don't want people depending on it.
1 parent 481c826 commit 8acd57d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/matplotlib/testing/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def is_called_from_pytest():
2121

2222

2323
# stolen from pytest
24-
def getrawcode(obj, trycall=True):
24+
def _getrawcode(obj, trycall=True):
2525
"""Return code object for given function."""
2626
try:
2727
return obj.__code__
@@ -38,7 +38,7 @@ def getrawcode(obj, trycall=True):
3838
return obj
3939

4040

41-
def copy_metadata(src_func, tgt_func):
41+
def _copy_metadata(src_func, tgt_func):
4242
"""Replicates metadata of the function. Returns target function."""
4343
tgt_func.__dict__.update(src_func.__dict__)
4444
tgt_func.__doc__ = src_func.__doc__
@@ -47,7 +47,7 @@ def copy_metadata(src_func, tgt_func):
4747
if hasattr(src_func, '__qualname__'):
4848
tgt_func.__qualname__ = src_func.__qualname__
4949
if not hasattr(tgt_func, 'compat_co_firstlineno'):
50-
tgt_func.compat_co_firstlineno = getrawcode(src_func).co_firstlineno
50+
tgt_func.compat_co_firstlineno = _getrawcode(src_func).co_firstlineno
5151
return tgt_func
5252

5353

lib/matplotlib/testing/_nose/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
import six
66
import sys
7-
from .. import copy_metadata
7+
from .. import _copy_metadata
88
from . import knownfail
99
from .exceptions import KnownFailureDidNotFailTest
1010

@@ -31,5 +31,5 @@ def failer(*args, **kwargs):
3131
if fail_condition and fail_condition != 'indeterminate':
3232
raise KnownFailureDidNotFailTest(msg)
3333
return result
34-
return copy_metadata(f, failer)
34+
return _copy_metadata(f, failer)
3535
return known_fail_decorator

lib/matplotlib/testing/decorators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from matplotlib import ft2font
2727
from matplotlib.testing.compare import comparable_formats, compare_images, \
2828
make_test_filename
29-
from . import copy_metadata, is_called_from_pytest
29+
from . import _copy_metadata, is_called_from_pytest
3030
from .exceptions import ImageComparisonFailure
3131

3232

@@ -335,7 +335,7 @@ def wrapper(extension):
335335
def __call__(self, func):
336336
self.delayed_init(func)
337337
if is_called_from_pytest():
338-
return copy_metadata(func, self.pytest_runner())
338+
return _copy_metadata(func, self.pytest_runner())
339339
else:
340340
import nose.tools
341341

@@ -348,7 +348,7 @@ def runner_wrapper():
348348
# nose bug...
349349
self.teardown()
350350

351-
return copy_metadata(func, runner_wrapper)
351+
return _copy_metadata(func, runner_wrapper)
352352

353353

354354
def image_comparison(baseline_images=None, extensions=None, tol=0,
@@ -484,7 +484,7 @@ def backend_switcher(*args, **kwargs):
484484
plt.switch_backend(prev_backend)
485485
return result
486486

487-
return copy_metadata(func, backend_switcher)
487+
return _copy_metadata(func, backend_switcher)
488488
return switch_backend_decorator
489489

490490

0 commit comments

Comments
 (0)
0