Commits

Lucas Taylor committed cf794ec

[intersphinx] [Fixes #622] env.warn called with incorrect number of arguments

Comments (0)

Files changed (2)

sphinx/ext/intersphinx.py

             # new format
             name, (uri, inv) = key, value
             if not name.isalnum():
-                env.warn('intersphinx identifier %r is not alphanumeric' % name)
+                env.warn(docname=None, msg='intersphinx identifier %r is not alphanumeric' % name)
         else:
             # old format, no name
             name, uri, inv = None, key, value

tests/test_intersphinx.py

     rn = missing_reference(app, app.env, node, contnode)
     assert rn is None
     assert contnode[0].astext() == 'py3k:unknown'
+
+
+@with_app(confoverrides={'extensions': 'sphinx.ext.intersphinx'})
+@with_tempdir
+def test_load_mappings_warnings(tempdir, app):
+    """
+    load_mappings issues a warning if new-style mapping
+    identifiers are not alphanumeric
+    """
+    inv_file = tempdir / 'inventory'
+    write_file(inv_file, inventory_v2)
+    app.config.intersphinx_mapping = {
+        'http://docs.python.org/': inv_file,
+        'py3k': ('http://docs.python.org/py3k/', inv_file),
+        'repoze.workflow': ('http://docs.repoze.org/workflow/', inv_file),
+        'django-taggit': ('http://django-taggit.readthedocs.org/en/latest/', inv_file)
+    }
+
+    app.config.intersphinx_cache_limit = 0
+    # load the inventory and check if it's done correctly
+    load_mappings(app)
+    assert len(app._warning.content) == 2
+
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.