Reimplement using Sphinx 4 APIs
- use ObjectDescription for IPRange - reimplement data handling in IPDomain - store target docname and anchors in data to avoid later lookups - remove broken entries from index - adapt tests
This commit is contained in:
		
							parent
							
								
									8bc07c611f
								
							
						
					
					
						commit
						49a3d89488
					
				
					 5 changed files with 331 additions and 289 deletions
				
			
		|  | @ -40,14 +40,14 @@ templates_path = ["_templates"] | |||
| source_suffix = ".rst" | ||||
| 
 | ||||
| # The encoding of source files. | ||||
| # source_encoding = 'utf-8-sig' | ||||
| # source_encoding = 'utf-8-ip_range' | ||||
| 
 | ||||
| # The master toctree document. | ||||
| master_doc = "index" | ||||
| 
 | ||||
| # General information about the project. | ||||
| project = "Sphinxext IP Tests" | ||||
| copyright = "2016, Jan Dittberner" | ||||
| copyright = "2016-2021, Jan Dittberner" | ||||
| author = "Jan Dittberner" | ||||
| 
 | ||||
| # The version info for the project you're documenting, acts as replacement for | ||||
|  | @ -55,9 +55,9 @@ author = "Jan Dittberner" | |||
| # built documents. | ||||
| # | ||||
| # The short X.Y version. | ||||
| version = "0.1.0" | ||||
| version = "0.5.0" | ||||
| # The full version, including alpha/beta/rc tags. | ||||
| release = "0.1.0" | ||||
| release = version + "-dev" | ||||
| 
 | ||||
| # The language for content autogenerated by Sphinx. Refer to documentation | ||||
| # for a list of supported languages. | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| Test page 3 | ||||
| =========== | ||||
| 
 | ||||
| This page contains :ip:v6:`2001:dead:beef::1` like :doc:`testpage2` does. | ||||
| This page contains :ip:v6:`2001:dead:beef::1` from :ip:v6range:`2001:dead:beef::/64` | ||||
| like :doc:`testpage2` does. | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ def run(extra_args=[]): | |||
|             "The sphinx package is needed to run the jandd.sphinxext.ip " "test suite." | ||||
|         ) | ||||
| 
 | ||||
|     from .test_ip import TestIPExtension | ||||
|     from tests.test_ip import TestIPExtension | ||||
| 
 | ||||
|     print("Running jandd.sphinxext.ip test suite ...") | ||||
| 
 | ||||
|  |  | |||
|  | @ -28,10 +28,10 @@ class TestIPExtension(unittest.TestCase): | |||
|     def test_ip_domaindata(self): | ||||
|         self.assertIn("ip", self.app.env.domaindata) | ||||
|         ipdomdata = self.app.env.domaindata["ip"] | ||||
|         self.assertIn("v4", ipdomdata) | ||||
|         self.assertIn("v6", ipdomdata) | ||||
|         self.assertIn("v4range", ipdomdata) | ||||
|         self.assertIn("v6range", ipdomdata) | ||||
|         self.assertIn("ip_refs", ipdomdata) | ||||
|         self.assertIn("range_refs", ipdomdata) | ||||
|         self.assertIn("range_nodes", ipdomdata) | ||||
|         self.assertIn("ranges", ipdomdata) | ||||
|         self.assertIn("ips", ipdomdata) | ||||
| 
 | ||||
|     def find_in_index(self, entry): | ||||
|  | @ -43,19 +43,15 @@ class TestIPExtension(unittest.TestCase): | |||
|         self.fail("%s not found in index" % entry) | ||||
| 
 | ||||
|     def test_ip4_addresses(self): | ||||
|         ipv4 = self.app.env.domaindata["ip"]["v4"] | ||||
|         ips = self.app.env.domaindata["ip"]["ips"] | ||||
|         for ip in IP4_ADDRESSES: | ||||
|             self.assertIn(ip, ipv4) | ||||
|             self.assertIn(ip, [item["ip"] for item in ips]) | ||||
|             self.assertIn(ip, ips) | ||||
|             self.find_in_index("IPv4 address; %s" % ip) | ||||
|             self.find_in_index("%s; Test page 2" % ip) | ||||
| 
 | ||||
|     def test_ip6_addresses(self): | ||||
|         ipv6 = self.app.env.domaindata["ip"]["v6"] | ||||
|         ips = self.app.env.domaindata["ip"]["ips"] | ||||
|         for ip in IP6_ADDRESSES: | ||||
|             self.assertIn(ip, ipv6) | ||||
|             self.assertIn(ip, [item["ip"] for item in ips]) | ||||
|             self.assertIn(ip, ips) | ||||
|             self.find_in_index("IPv6 address; %s" % ip) | ||||
|             self.find_in_index("%s; Test page 2" % ip) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue