Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breathe's tests fail for sphinx >= 2.2.2 with "Domain 'c' is not registered" #465

Closed
D4N opened this issue Dec 24, 2019 · 2 comments · Fixed by #472
Closed

Breathe's tests fail for sphinx >= 2.2.2 with "Domain 'c' is not registered" #465

D4N opened this issue Dec 24, 2019 · 2 comments · Fixed by #472
Assignees
Labels
bug Problem in existing code test Unit tests, acceptance tests

Comments

@D4N
Copy link
Contributor

D4N commented Dec 24, 2019

A recent update of Sphinx to 2.2.2 in Fedora Rawhide broke the unit test of breathe. Now 4 tests are failing with:

======================================================================
ERROR: test_renderer.test_render_c_typedef
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dan/packages/github.com/michaeljones/breathe/.env3/lib64/python3.7/site-packages/sphinx/environment/__init__.py", line 515, in get_domain
    return self.domains[domainname]
KeyError: 'c'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dan/packages/github.com/michaeljones/breathe/.env3/lib64/python3.7/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/dan/packages/github.com/michaeljones/breathe/tests/test_renderer.py", line 286, in test_render_c_typedef
    signature = find_node(render(member_def, domain='c'), 'desc_signature')
  File "/home/dan/packages/github.com/michaeljones/breathe/tests/test_renderer.py", line 257, in render
    return renderer.render(member_def)
  File "/home/dan/packages/github.com/michaeljones/breathe/breathe/renderer/sphinxrenderer.py", line 1308, in render
    result = method(self, node)
  File "/home/dan/packages/github.com/michaeljones/breathe/breathe/renderer/sphinxrenderer.py", line 1249, in dispatch_memberdef
    return self.visit_typedef(node)
  File "/home/dan/packages/github.com/michaeljones/breathe/breathe/renderer/sphinxrenderer.py", line 1092, in visit_typedef
    update_signature=update_signature)
  File "/home/dan/packages/github.com/michaeljones/breathe/breathe/renderer/sphinxrenderer.py", line 412, in render_declaration
    nodes = self.run_domain_directive(obj_type, [declaration.replace('\n', ' ')])
  File "/home/dan/packages/github.com/michaeljones/breathe/breathe/renderer/sphinxrenderer.py", line 357, in run_domain_directive
    nodes = domain_directive.run()
  File "/home/dan/packages/github.com/michaeljones/breathe/.env3/lib64/python3.7/site-packages/sphinx/directives/__init__.py", line 187, in run
    self.add_target_and_index(name, sig, signode)
  File "/home/dan/packages/github.com/michaeljones/breathe/.env3/lib64/python3.7/site-packages/sphinx/domains/c.py", line 209, in add_target_and_index
    domain = cast(CDomain, self.env.get_domain('c'))
  File "/home/dan/packages/github.com/michaeljones/breathe/.env3/lib64/python3.7/site-packages/sphinx/environment/__init__.py", line 517, in get_domain
    raise ExtensionError(__('Domain %r is not registered') % domainname)
sphinx.errors.ExtensionError: Domain 'c' is not registered

The other failing tests (with a similarly looking backtrace) are:

  • test_renderer.test_render_c_function_typedef
  • test_renderer.test_render_define_initializer
  • test_renderer.test_render_define_no_initializer

Unfortunately, I am not too proficient with breathe and couldn't find a solution of this issue. My guess would be that the unit tests are not registering the C domain, but I am too unfamiliar with sphinx' API to figure out how to properly register it.

@t-b
Copy link
Contributor

t-b commented Jan 27, 2020

I think breathe needs to call the setup routine at https://github.com/sphinx-doc/sphinx/blob/1ef607b4ccabe3410d8aca68a7dbd796e14d578d/sphinx/environment/__init__.py#L199 before trying to access the domains. But that is just a guess.

@vermeeren vermeeren self-assigned this Feb 2, 2020
@vermeeren vermeeren added bug Problem in existing code test Unit tests, acceptance tests labels Feb 2, 2020
@vermeeren
Copy link
Collaborator

Breathe v4.14.1 is now released with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problem in existing code test Unit tests, acceptance tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants