Fix deprecations and modernize testing
- use pytest and tox for testing - fix deprecation warnings from Sphinx and Docutils
This commit is contained in:
		
							parent
							
								
									3daf568fb6
								
							
						
					
					
						commit
						0af66c6964
					
				
					 10 changed files with 503 additions and 222 deletions
				
			
		|  | @ -1,7 +1,7 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| 
 | ||||
| from io import StringIO | ||||
| from .util import TestApp, test_root | ||||
| from .util import SphinxTestApplication, test_root | ||||
| import unittest | ||||
| 
 | ||||
| 
 | ||||
|  | @ -16,7 +16,7 @@ class TestIPExtension(unittest.TestCase): | |||
|         if not (test_root / '_static').exists(): | ||||
|             (test_root / '_static').mkdir() | ||||
|         self.feed_warnfile = StringIO() | ||||
|         self.app = TestApp( | ||||
|         self.app = SphinxTestApplication( | ||||
|             buildername='html', warning=self.feed_warnfile, cleanenv=True) | ||||
|         self.app.build(force_all=True, filenames=[]) | ||||
| 
 | ||||
|  | @ -34,7 +34,7 @@ class TestIPExtension(unittest.TestCase): | |||
|         self.assertIn('ips', ipdomdata) | ||||
| 
 | ||||
|     def find_in_index(self, entry): | ||||
|         indexentries = self.app.env.indexentries | ||||
|         indexentries = self.app.env.get_domain('index').entries | ||||
|         for index in indexentries: | ||||
|             for value in indexentries[index]: | ||||
|                 if value[1] == entry: | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ from sphinx import application | |||
| __all__ = [ | ||||
|     'test_root', | ||||
|     'raises', 'raises_msg', 'Struct', | ||||
|     'ListOutput', 'TestApp', 'with_app', 'gen_with_app', | ||||
|     'ListOutput', 'SphinxTestApplication', 'with_app', 'gen_with_app', | ||||
|     'Path', 'with_tempdir', 'write_file', | ||||
|     'sprint', | ||||
| ] | ||||
|  | @ -82,7 +82,7 @@ class ListOutput(object): | |||
|         self.content.append(text) | ||||
| 
 | ||||
| 
 | ||||
| class TestApp(application.Sphinx): | ||||
| class SphinxTestApplication(application.Sphinx): | ||||
|     """ | ||||
|     A subclass of :class:`Sphinx` that runs on the test root, with some | ||||
|     better default values for the initialization parameters. | ||||
|  | @ -148,7 +148,7 @@ def with_app(*args, **kwargs): | |||
|     def generator(func): | ||||
|         @wraps(func) | ||||
|         def deco(*args2, **kwargs2): | ||||
|             app = TestApp(*args, **kwargs) | ||||
|             app = SphinxTestApplication(*args, **kwargs) | ||||
|             func(app, *args2, **kwargs2) | ||||
|             # don't execute cleanup if test failed | ||||
|             app.cleanup() | ||||
|  | @ -164,7 +164,7 @@ def gen_with_app(*args, **kwargs): | |||
|     def generator(func): | ||||
|         @wraps(func) | ||||
|         def deco(*args2, **kwargs2): | ||||
|             app = TestApp(*args, **kwargs) | ||||
|             app = SphinxTestApplication(*args, **kwargs) | ||||
|             for item in func(app, *args2, **kwargs2): | ||||
|                 yield item | ||||
|             # don't execute cleanup if test failed | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue