aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources
diff options
context:
space:
mode:
authorAlex Hirzel <alex@hirzel.us>2018-11-09 20:06:51 -0500
committerAlex Hirzel <alex@hirzel.us>2018-11-09 20:06:51 -0500
commitc9aba4ad1e66ab40ea2f7320c4f9504099b7ac50 (patch)
tree4e38770256d3882d16f511e227021b21cb37bf21 /pkg_resources
parent63185e91406d6ba02fe42c6b7e188111054f1b14 (diff)
parentb0c746640f87ad2719a7ebfbdc226d3fd43296b6 (diff)
downloadexternal_python_setuptools-c9aba4ad1e66ab40ea2f7320c4f9504099b7ac50.tar.gz
external_python_setuptools-c9aba4ad1e66ab40ea2f7320c4f9504099b7ac50.tar.bz2
external_python_setuptools-c9aba4ad1e66ab40ea2f7320c4f9504099b7ac50.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/__init__.py13
-rw-r--r--pkg_resources/tests/test_resources.py11
2 files changed, 22 insertions, 2 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 2b8c4430..e6487be0 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -238,6 +238,9 @@ __all__ = [
'register_finder', 'register_namespace_handler', 'register_loader_type',
'fixup_namespace_packages', 'get_importer',
+ # Warnings
+ 'PkgResourcesDeprecationWarning',
+
# Deprecated/backward compatibility only
'run_main', 'AvailableDistributions',
]
@@ -2340,7 +2343,7 @@ class EntryPoint:
warnings.warn(
"Parameters to load are deprecated. Call .resolve and "
".require separately.",
- DeprecationWarning,
+ PkgResourcesDeprecationWarning,
stacklevel=2,
)
if require:
@@ -3163,3 +3166,11 @@ def _initialize_master_working_set():
# match order
list(map(working_set.add_entry, sys.path))
globals().update(locals())
+
+class PkgResourcesDeprecationWarning(Warning):
+ """
+ Base class for warning about deprecations in ``pkg_resources``
+
+ This class is not derived from ``DeprecationWarning``, and as such is
+ visible by default.
+ """
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 171ba2f9..86afcf74 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -15,7 +15,7 @@ import pkg_resources
from pkg_resources import (
parse_requirements, VersionConflict, parse_version,
Distribution, EntryPoint, Requirement, safe_version, safe_name,
- WorkingSet)
+ WorkingSet, PkgResourcesDeprecationWarning)
# from Python 3.6 docs.
@@ -492,6 +492,15 @@ class TestEntryPoints:
with pytest.raises(ValueError):
EntryPoint.parse_map(self.submap_str)
+ def testDeprecationWarnings(self):
+ ep = EntryPoint(
+ "foo", "pkg_resources.tests.test_resources", ["TestEntryPoints"],
+ ["x"]
+ )
+ with pytest.warns(pkg_resources.PkgResourcesDeprecationWarning):
+ ep.load(require=False)
+
+
class TestRequirements:
def testBasics(self):