aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--changelog.d/1899.change.rst1
-rw-r--r--pkg_resources/__init__.py11
-rw-r--r--pytest.ini17
3 files changed, 22 insertions, 7 deletions
diff --git a/changelog.d/1899.change.rst b/changelog.d/1899.change.rst
new file mode 100644
index 00000000..30768439
--- /dev/null
+++ b/changelog.d/1899.change.rst
@@ -0,0 +1 @@
+Test suite now fails on warnings.
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 75563f95..88d4bdca 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -1235,12 +1235,13 @@ class ResourceManager:
mode = os.stat(path).st_mode
if mode & stat.S_IWOTH or mode & stat.S_IWGRP:
msg = (
- "%s is writable by group/others and vulnerable to attack "
- "when "
- "used with get_resource_filename. Consider a more secure "
+ "Extraction path is writable by group/others "
+ "and vulnerable to attack when "
+ "used with get_resource_filename ({path}). "
+ "Consider a more secure "
"location (set with .set_extraction_path or the "
- "PYTHON_EGG_CACHE environment variable)." % path
- )
+ "PYTHON_EGG_CACHE environment variable)."
+ ).format(**locals())
warnings.warn(msg, UserWarning)
def postprocess(self, tempname, filename):
diff --git a/pytest.ini b/pytest.ini
index 904fe336..af61043f 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -3,5 +3,18 @@ addopts=--doctest-modules --flake8 --doctest-glob=pkg_resources/api_tests.txt -r
norecursedirs=dist build *.egg setuptools/extern pkg_resources/extern pkg_resources/tests/data tools .* setuptools/_vendor pkg_resources/_vendor
doctest_optionflags=ELLIPSIS ALLOW_UNICODE
filterwarnings =
- # https://github.com/pypa/setuptools/issues/1823
- ignore:bdist_wininst command is deprecated
+ # Fail on warnings
+ error
+ # https://github.com/pypa/setuptools/issues/1823
+ ignore:bdist_wininst command is deprecated
+ # Suppress this error; unimportant for CI tests
+ ignore:Extraction path is writable by group/others:UserWarning
+ # Suppress Python 2 deprecation warning
+ ignore:Setuptools will stop working on Python 2:UserWarning
+ # Suppress weird RuntimeWarning.
+ ignore:Parent module 'setuptools' not found while handling absolute import:RuntimeWarning
+ # Suppress use of bytes for filenames on Windows until fixed #2016
+ ignore:The Windows bytes API has been deprecated:DeprecationWarning
+ # Suppress other Python 2 UnicodeWarnings
+ ignore:Unicode equal comparison failed to convert:UnicodeWarning
+ ignore:Unicode unequal comparison failed to convert:UnicodeWarning