File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 1414from queue import Queue
1515from unittest import mock
1616
17+ import docutils
1718import pytest
1819from urllib3 .poolmanager import PoolManager
1920
@@ -142,14 +143,19 @@ def test_defaults(app):
142143 'uri' : 'http://localhost:7777#!bar' ,
143144 'info' : '' ,
144145 }
145- assert rowsby ['http://localhost:7777/image2.png' ] == {
146- 'filename' : 'links.rst' ,
147- 'lineno' : 13 ,
148- 'status' : 'broken' ,
149- 'code' : 0 ,
150- 'uri' : 'http://localhost:7777/image2.png' ,
151- 'info' : '404 Client Error: Not Found for url: http://localhost:7777/image2.png' ,
152- }
146+
147+ def _missing_resource (filename : str , lineno : int ):
148+ return {
149+ 'filename' : 'links.rst' ,
150+ 'lineno' : lineno ,
151+ 'status' : 'broken' ,
152+ 'code' : 0 ,
153+ 'uri' : f'http://localhost:7777/{ filename } ' ,
154+ 'info' : f'404 Client Error: Not Found for url: http://localhost:7777/{ filename } ' ,
155+ }
156+ accurate_linenumbers = docutils .__version_info__ [:2 ] >= (0 , 21 )
157+ image2_lineno = 12 if accurate_linenumbers else 13
158+ assert rowsby ['http://localhost:7777/image2.png' ] == _missing_resource ("image2.png" , image2_lineno )
153159 # looking for '#top' and '#does-not-exist' not found should fail
154160 assert rowsby ["http://localhost:7777/#top" ]["info" ] == "Anchor 'top' not found"
155161 assert rowsby ["http://localhost:7777/#top" ]["status" ] == "broken"
You can’t perform that action at this time.
0 commit comments