From: Vladimír Vondruš Date: Mon, 8 Jun 2020 20:27:22 +0000 (+0200) Subject: documentation/doxygen: reduce boilerplate in the tests. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=1228d92a09b82a155c23d04a704cbb7adb4d19b7;p=blog.git documentation/doxygen: reduce boilerplate in the tests. Followup to 5eb113bae33b05701b8e213d2400298ada29138e. --- diff --git a/documentation/test_doxygen/__init__.py b/documentation/test_doxygen/__init__.py index 8cd60389..7b94f1d4 100644 --- a/documentation/test_doxygen/__init__.py +++ b/documentation/test_doxygen/__init__.py @@ -24,20 +24,41 @@ import copy import os +import re import shutil import subprocess +import sys import unittest from doxygen import State, parse_doxyfile, run, default_templates, default_wildcard, default_index_pages, default_config +# https://stackoverflow.com/a/12867228 +_camelcase_to_snakecase = re.compile('((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))') + def doxygen_version(): return subprocess.check_output(['doxygen', '-v']).decode('utf-8').strip() class BaseTestCase(unittest.TestCase): - def __init__(self, path, dir, *args, **kwargs): + def __init__(self, *args, dir=None, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) - # Source files for test_something.py are in something_{dir}/ subdirectory - self.path = os.path.join(os.path.dirname(os.path.realpath(path)), os.path.splitext(os.path.basename(path))[0][5:] + ('_' + dir if dir else '')) + + # Get the test filename from the derived class module file. If path is + # not supplied, get it from derived class name converted to snake_case + path = sys.modules[self.__class__.__module__].__file__ + if not dir: dir = _camelcase_to_snakecase.sub('_\\1', self.__class__.__name__).lower() + + # Full directory name (for test_something.py the directory is + # something_{dir} + dir_prefix = os.path.splitext(os.path.basename(path))[0][5:] + if dir and dir_prefix != dir: + self.dirname = dir_prefix + '_' + dir + else: + self.dirname = dir_prefix + # Absolute path to this directory + self.path = os.path.join(os.path.dirname(os.path.realpath(path)), self.dirname) + + if not os.path.exists(self.path): + raise AssertionError("autodetected path {} doesn't exist".format(self.path)) # Display ALL THE DIFFS self.maxDiff = None diff --git a/documentation/test_doxygen/page_footernavigation/Doxyfile b/documentation/test_doxygen/page_footer_navigation/Doxyfile similarity index 100% rename from documentation/test_doxygen/page_footernavigation/Doxyfile rename to documentation/test_doxygen/page_footer_navigation/Doxyfile diff --git a/documentation/test_doxygen/page_footernavigation/input.dox b/documentation/test_doxygen/page_footer_navigation/input.dox similarity index 100% rename from documentation/test_doxygen/page_footernavigation/input.dox rename to documentation/test_doxygen/page_footer_navigation/input.dox diff --git a/documentation/test_doxygen/page_footernavigation/subpage1.html b/documentation/test_doxygen/page_footer_navigation/subpage1.html similarity index 100% rename from documentation/test_doxygen/page_footernavigation/subpage1.html rename to documentation/test_doxygen/page_footer_navigation/subpage1.html diff --git a/documentation/test_doxygen/page_footernavigation/subpage2.html b/documentation/test_doxygen/page_footer_navigation/subpage2.html similarity index 100% rename from documentation/test_doxygen/page_footernavigation/subpage2.html rename to documentation/test_doxygen/page_footer_navigation/subpage2.html diff --git a/documentation/test_doxygen/test_compound.py b/documentation/test_doxygen/test_compound.py index a04b9faf..870542cc 100644 --- a/documentation/test_doxygen/test_compound.py +++ b/documentation/test_doxygen/test_compound.py @@ -30,9 +30,6 @@ from distutils.version import LooseVersion from . import IntegrationTestCase, doxygen_version class Listing(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'listing', *args, **kwargs) - def test_index_pages(self): self.run_doxygen(wildcard='index.xml', index_pages=['annotated', 'namespaces', 'pages']) self.assertEqual(*self.actual_expected_contents('annotated.html')) @@ -70,9 +67,6 @@ class Listing(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('page-no-toc.html')) class Detailed(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'detailed', *args, **kwargs) - def test_namespace(self): self.run_doxygen(wildcard='namespaceNamee.xml') self.assertEqual(*self.actual_expected_contents('namespaceNamee.html')) @@ -114,9 +108,6 @@ class Detailed(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('File_8h.html')) class Ignored(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'ignored', *args, **kwargs) - def test(self): self.run_doxygen(index_pages=[], wildcard='*.xml') @@ -134,9 +125,6 @@ class Ignored(IntegrationTestCase): self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'classBrief.html'))) class Modules(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'modules', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('group__group.html')) @@ -145,9 +133,6 @@ class Modules(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('modules.html')) class ModulesInNamespace(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'modules_in_namespace', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('group__group1.html')) @@ -156,9 +141,6 @@ class ModulesInNamespace(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('file3_8h.html')) class Deprecated(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'deprecated', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') # Test that the [deprecated] label is in all places where it should ne @@ -195,9 +177,6 @@ class Deprecated(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('structDeprecatedNamespace_1_1DeprecatedClass.html')) class NamespaceMembersInFileScope(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'namespace_members_in_file_scope', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='namespaceNamespace.xml') @@ -213,9 +192,6 @@ class NamespaceMembersInFileScope(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('File_8h.html')) class NamespaceMembersInFileScopeDefineBaseUrl(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'namespace_members_in_file_scope_define_base_url', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.14"), "https://github.com/doxygen/doxygen/pull/653") def test(self): @@ -225,9 +201,6 @@ class NamespaceMembersInFileScopeDefineBaseUrl(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('File_8h.html')) class FilenameCase(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'filename_case', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') @@ -239,9 +212,6 @@ class FilenameCase(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('class_u_p_p_e_r_c_l_a_s_s.html')) class CrazyTemplateParams(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'crazy_template_params', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') @@ -249,9 +219,6 @@ class CrazyTemplateParams(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('File_8h.html')) class Includes(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'includes', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') @@ -273,9 +240,6 @@ class Includes(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('namespaceEmpty.html')) class IncludesDisabled(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'includes_disabled', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') @@ -288,9 +252,6 @@ class IncludesDisabled(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('structSpreadClass.html')) class IncludesUndocumentedFiles(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'includes_undocumented_files', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') @@ -304,9 +265,6 @@ class IncludesUndocumentedFiles(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('structSpreadClass.html', '../compound_includes_disabled/structSpreadClass.html')) class IncludesTemplated(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'includes_templated', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') @@ -315,9 +273,6 @@ class IncludesTemplated(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('structStruct.html')) class BaseDerivedInRootNamespace(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'base_derived_in_root_namespace', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') @@ -325,9 +280,6 @@ class BaseDerivedInRootNamespace(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('structNamespace_1_1BothBaseAndDerivedInRootNamespace.html')) class Since(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'since', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') @@ -359,9 +311,6 @@ class Since(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('pages.html')) class ExceptionReference(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'exception_reference', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('File_8h.html')) diff --git a/documentation/test_doxygen/test_contents.py b/documentation/test_doxygen/test_contents.py index abb2d28d..ffaf3a1d 100644 --- a/documentation/test_doxygen/test_contents.py +++ b/documentation/test_doxygen/test_contents.py @@ -39,17 +39,11 @@ def dot_version(): return re.match(".*version (?P\d+\.\d+\.\d+).*", subprocess.check_output(['dot', '-V'], stderr=subprocess.STDOUT).decode('utf-8').strip()).group('version') class Typography(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'typography', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class Blocks(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'blocks', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('index.html')) @@ -76,17 +70,11 @@ class Blocks(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('old.html', 'old_1814.html')) class Internal(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'internal', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class Code(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'code', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) @@ -96,9 +84,6 @@ class Code(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('warnings.html')) class CodeLanguage(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'code_language', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"), "https://github.com/doxygen/doxygen/pull/621") def test(self): @@ -118,9 +103,6 @@ class CodeLanguage(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('warnings.html')) class Image(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'image', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) @@ -137,9 +119,6 @@ class Image(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('imagelink.html')) class Math(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'math', *args, **kwargs) - @unittest.skipUnless(shutil.which('latex'), "Math rendering requires LaTeX installed") def test(self): @@ -154,7 +133,7 @@ class Math(IntegrationTestCase): class MathCached(IntegrationTestCase): def __init__(self, *args, **kwargs): - super().__init__(__file__, 'math_cached', *args, **kwargs) + super().__init__(*args, **kwargs) # Actually generated from $ \frac{\tau}{2} $ tho self.tau_half_hash = sha1("""$ \pi $""".encode('utf-8')).digest() @@ -258,17 +237,11 @@ class MathCached(IntegrationTestCase): self.assertFalse(os.path.exists(os.path.join(self.path, 'xml/math.cache'))) class Tagfile(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'tagfile', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class Custom(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'custom', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) @@ -294,9 +267,6 @@ class Custom(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('dot.html', file)) class ParseError(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'parse_error', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='broken.xml') @@ -304,9 +274,6 @@ class ParseError(BaseTestCase): self.assertTrue(os.path.exists(os.path.join(self.path, 'html', 'index.html'))) class AutobriefCppComments(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'autobrief_cpp_comments', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='File_8h.xml') self.assertEqual(*self.actual_expected_contents('File_8h.html')) @@ -315,9 +282,6 @@ class AutobriefCppComments(IntegrationTestCase): # properly. class AutobriefHr(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'autobrief_hr', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) < LooseVersion("1.8.15"), "1.8.15 doesn't put into anymore") def test(self): @@ -325,17 +289,11 @@ class AutobriefHr(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html')) class AutobriefMultiline(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'autobrief_multiline', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='namespaceNamespace.xml') self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html')) class AutobriefHeading(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'autobrief_heading', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) < LooseVersion("1.8.15"), "1.8.15 doesn't put into anymore") def test(self): @@ -343,17 +301,11 @@ class AutobriefHeading(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html')) class SectionUnderscoreOne(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'section_underscore_one', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class SectionsHeadings(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'sections_headings', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) @@ -367,34 +319,22 @@ class SectionsHeadings(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('File_8h.html')) class AnchorInBothGroupAndNamespace(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'anchor_in_both_group_and_namespace', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('namespaceFoo.html')) self.assertEqual(*self.actual_expected_contents('group__fizzbuzz.html')) class AnchorHtmlNoPrefixBug(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'anchor_html_no_prefix_bug', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='some-long-page-name.xml') self.assertEqual(*self.actual_expected_contents('some-long-page-name.html')) class UnexpectedSections(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'unexpected_sections', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='File_8h.xml') self.assertEqual(*self.actual_expected_contents('File_8h.html')) class Dot(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'dot', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') @@ -412,9 +352,6 @@ class Dot(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('warnings.html')) class Htmlinclude(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'htmlinclude', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) diff --git a/documentation/test_doxygen/test_cpp.py b/documentation/test_doxygen/test_cpp.py index 366fd887..7ae51968 100644 --- a/documentation/test_doxygen/test_cpp.py +++ b/documentation/test_doxygen/test_cpp.py @@ -29,9 +29,6 @@ from distutils.version import LooseVersion from . import IntegrationTestCase, doxygen_version class EnumClass(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'enum_class', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"), "https://github.com/doxygen/doxygen/pull/627") def test(self): @@ -39,9 +36,6 @@ class EnumClass(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('File_8h.html')) class TemplateAlias(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'template_alias', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"), "https://github.com/doxygen/doxygen/pull/626") def test(self): @@ -50,9 +44,6 @@ class TemplateAlias(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('structTemplate.html')) class Derived(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'derived', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('classNamespace_1_1A.html')) @@ -66,9 +57,6 @@ class Derived(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('annotated.html')) class Friends(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'friends', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"), "1.8.13 produces invalid XML for friend declarations") def test(self): @@ -77,26 +65,17 @@ class Friends(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('classTemplate.html')) class SignalsSlots(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'signals_slots', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='classClass.xml') self.assertEqual(*self.actual_expected_contents('classClass.html')) class VariableTemplate(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'variable_template', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('structFoo.html')) self.assertEqual(*self.actual_expected_contents('structBar.html')) class FunctionAttributes(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'function_attributes', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('structFoo.html')) @@ -105,9 +84,6 @@ class FunctionAttributes(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('structFinal.html')) class FunctionAttributesNospace(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'function_attributes_nospace', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='structFoo.xml') self.assertEqual(*self.actual_expected_contents('structFoo.html')) diff --git a/documentation/test_doxygen/test_doxyfile.py b/documentation/test_doxygen/test_doxyfile.py index 00f6cf45..62c6d00f 100644 --- a/documentation/test_doxygen/test_doxyfile.py +++ b/documentation/test_doxygen/test_doxyfile.py @@ -128,10 +128,7 @@ copy a link to the result using ⌘ with self.assertRaises(NotImplementedError): parse_doxyfile(state, 'test_doxygen/doxyfile/Doxyfile-subdirs') -class Upgrade(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'upgrade_custom_variables', *args, **kwargs) - +class UpgradeCustomVariables(BaseTestCase): def test(self): # Copy the Doxyfile to a new location because it gets overwritten shutil.copyfile(os.path.join(self.path, 'Doxyfile'), diff --git a/documentation/test_doxygen/test_example.py b/documentation/test_doxygen/test_example.py index 92f7752b..ff3a5e85 100644 --- a/documentation/test_doxygen/test_example.py +++ b/documentation/test_doxygen/test_example.py @@ -29,9 +29,6 @@ from distutils.version import LooseVersion from . import IntegrationTestCase, doxygen_version class Example(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, '', *args, **kwargs) - def test_cpp(self): self.run_doxygen(index_pages=[], wildcard='*.xml') diff --git a/documentation/test_doxygen/test_layout.py b/documentation/test_doxygen/test_layout.py index e02b047b..3170c865 100644 --- a/documentation/test_doxygen/test_layout.py +++ b/documentation/test_doxygen/test_layout.py @@ -29,9 +29,6 @@ from _search import search_filename, searchdata_filename, searchdata_filename_b8 from . import BaseTestCase class Layout(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, '', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='index.xml') self.assertEqual(*self.actual_expected_contents('pages.html')) @@ -41,9 +38,6 @@ class Layout(BaseTestCase): self.assertTrue(os.path.exists(os.path.join(self.path, 'html', 'favicon-light.png'))) class GeneratedDoxyfile(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'generated_doxyfile', *args, **kwargs) - def test(self): if os.path.exists(os.path.join(self.path, 'Doxyfile')): os.remove(os.path.join(self.path, 'Doxyfile')) @@ -53,74 +47,47 @@ class GeneratedDoxyfile(BaseTestCase): self.assertEqual(*self.actual_expected_contents('index.html')) class Minimal(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'minimal', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class TemplateFallback(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'template_fallback', *args, **kwargs) - def test(self): self.run_doxygen(templates=self.path, wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class NavbarSingleColumn(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'navbar_single_column', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class NavbarHtml(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'navbar_html', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class NavbarMainProjectUrl(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'navbar_main_project_url', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class NavbarProjectLogo(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'navbar_project_logo', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class NavbarProjectLogoMainProjectUrl(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'navbar_project_logo_main_project_url', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class SearchBinary(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'search_binary', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) self.assertTrue(os.path.exists(os.path.join(self.path, 'html', searchdata_filename))) -class SearchOpenSearch(BaseTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'search_opensearch', *args, **kwargs) - +class SearchOpensearch(BaseTestCase): def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) diff --git a/documentation/test_doxygen/test_page.py b/documentation/test_doxygen/test_page.py index 361fad9e..ddf36a97 100644 --- a/documentation/test_doxygen/test_page.py +++ b/documentation/test_doxygen/test_page.py @@ -30,17 +30,11 @@ from distutils.version import LooseVersion from . import IntegrationTestCase, doxygen_version class Order(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'order', *args, **kwargs) - def test(self): self.run_doxygen(index_pages=['pages'], wildcard='index.xml') self.assertEqual(*self.actual_expected_contents('pages.html')) class Brief(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'brief', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"), "https://github.com/doxygen/doxygen/pull/624") def test(self): @@ -50,9 +44,6 @@ class Brief(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('page-b.html')) class Toc(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'toc', *args, **kwargs) - @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"), "https://github.com/doxygen/doxygen/pull/625") def test(self): @@ -60,52 +51,34 @@ class Toc(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('page-toc.html')) class InNavbar(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'in_navbar', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='page*.xml') self.assertEqual(*self.actual_expected_contents('page-in-navbar.html')) self.assertEqual(*self.actual_expected_contents('page-b.html')) class FooterNavigation(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'footernavigation', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='subpage*.xml') self.assertEqual(*self.actual_expected_contents('subpage1.html')) self.assertEqual(*self.actual_expected_contents('subpage2.html')) class EmptyIndex(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'empty_index', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) class EmptyTitle(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'empty_title', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='untitled.xml') self.assertEqual(*self.actual_expected_contents('untitled.html')) class SubpageOfIndex(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'subpage_of_index', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertEqual(*self.actual_expected_contents('page.html')) self.assertEqual(*self.actual_expected_contents('pages.html')) class EmptyPage(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'empty_page', *args, **kwargs) - def test(self): self.run_doxygen(wildcard='*.xml') self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'group__bla_md_input.html'))) diff --git a/documentation/test_doxygen/test_search.py b/documentation/test_doxygen/test_search.py index 16cb37d6..73d7d963 100755 --- a/documentation/test_doxygen/test_search.py +++ b/documentation/test_doxygen/test_search.py @@ -34,9 +34,6 @@ from _search import pretty_print, searchdata_filename from test_doxygen import IntegrationTestCase class Search(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, '', *args, **kwargs) - def test(self): self.run_doxygen(index_pages=[], wildcard='*.xml') @@ -228,10 +225,7 @@ union [59] (EntryType.VAR, CssClass.DEFAULT, 'var') """.strip()) -class SearchLongSuffixLength(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, 'long_suffix_length', *args, **kwargs) - +class LongSuffixLength(IntegrationTestCase): def test(self): self.run_doxygen(index_pages=[], wildcard='*.xml') diff --git a/documentation/test_doxygen/test_undocumented.py b/documentation/test_doxygen/test_undocumented.py index bd9d0165..2252a9af 100644 --- a/documentation/test_doxygen/test_undocumented.py +++ b/documentation/test_doxygen/test_undocumented.py @@ -30,10 +30,7 @@ from _search import search_data_header_struct, searchdata_filename from . import IntegrationTestCase -class Test(IntegrationTestCase): - def __init__(self, *args, **kwargs): - super().__init__(__file__, '', *args, **kwargs) - +class Undocumented(IntegrationTestCase): def test(self): self.run_doxygen(wildcard='*.xml')