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

Does not working test-reports "links" option in sphinx-needs versions >= v1.0.2 #51

Closed
magyarosiR opened this issue Dec 16, 2022 · 3 comments · Fixed by #52
Closed

Does not working test-reports "links" option in sphinx-needs versions >= v1.0.2 #51

magyarosiR opened this issue Dec 16, 2022 · 3 comments · Fixed by #52

Comments

@magyarosiR
Copy link

After I increase Sphinx, Test-Reports and Sphinx-Needs versions I got an error message after I built my project:

Sphinx parallel build error:
NotImplementedError: <class 'sphinx.writers.html5.HTML5Translator'> departing unknown node type: NeedIncoming

or

Sphinx parallel build error:
NotImplementedError: <class 'sphinx.writers.html5.HTML5Translator'> departing unknown node type: NeedOutgoing

Versions:

  • from Sphinx: 4.5.0 to 5.3.0
  • from Test-Reports 0.3.6 to 1.0.0
  • from Sphinx-Needs (sphinxcontrib.needs) 0.7.8 to 1.1.0

I played with the versions and with my implementation and I realized that problem is coming up, when increasing Sphinx-Needs version above 1.0.2. When I used <=1.0.2 everything works fine.

I have connection between Test Results (Test Cases, Test Suites from Test-Reports extension), and other own created need types using extra options. Between Test Cases (or Test Suites) and Test Specifications I am using the :links: extra option from Test-Results extension.

When I want to link from a Test Case or Test Suite to a Test Specification I got this error message, without linking the project works.

Example implementations of Test Suite and Test Case in reStructuredText:

.. test-suite:: No title
   :id: TESTSUITE_1
   :file: ./source/tests/test_res_addproduct.xml
   :suite: test_res_addproduct-123
   :collapse: true
   :links: TESTSPEC_123
.. test-case:: No title
   :id: TESTCASE_1
   :file: ./source/tests/test_res_addproduct.xml
   :suite: test_res_addproduct-123
   :case: test_button
   :collapse: true
   :links: TESTSPEC_123

I got a feedback from Useblocks side to remove Sphinx parallel build while this bug has been fixed, after I removed I got the error message below:

Exception occurred:
  File "/home/dockeruser/.local/lib/python3.10/site-packages/docutils/nodes.py", line 2056, in unknown_departure
    raise NotImplementedError(
NotImplementedError: <class 'sphinx.writers.html5.HTML5Translator'> departing unknown node type: NeedOutgoing

Important finding:
If I put the "target" need in the file where the Test Case or Test Suite is, the build process is successful.

@danwos
Copy link
Member

danwos commented Dec 16, 2022

Thanks for reporting and adding a detailed error description 👍

I was able to reproduce it and could create a test case.
However, no solution yet.

But it looks like the handlers for need_incoming and need_outgoing are not called if :links are set by a Sphinx-Test-Report directive (like test-suite or test-case) in the file only.

When I add a dummy-need, which is also setting a link, then my test case works:

.. spec:: A dummy need
   :id: SPEC_001
   :links: TESTSPEC_123

This means the need_outgoing and need_incoming roles are correctly handled.
Only the handlers itself get not executed for the file.

Argh, I think I have it.
Sphinx-Needs is storing, which directive/role is used in which file so that it calls the needed handlers only for these files.
This allows us to skip any performance-costing doctree-lookups.

This mechanism is not yet part of Sphinx-Test-Report, so the handlers get not called if no other Sphinx-Needs "links" are used somewhere in the same file.

Give me some minutes :)

danwos added a commit that referenced this issue Dec 16, 2022
":links:" where not handled correctly, if not other
Sphinx-Need object was part of the same document.

Fixes #51
danwos added a commit that referenced this issue Dec 16, 2022
":links:" where not handled correctly, if not other
Sphinx-Need object was part of the same document.

Fixes #51
danwos added a commit that referenced this issue Dec 16, 2022
":links:" where not handled correctly, if not other
Sphinx-Need object was part of the same document.

Fixes #51
@danwos danwos closed this as completed in 0f1ee42 Dec 16, 2022
@danwos
Copy link
Member

danwos commented Dec 16, 2022

Fix is out with PR #52.

@magyarosiR can you please test, if the version on master solves all the problems now?
Simply install via pip install --upgrade git+https://github.com/useblocks/sphinx-test-reports.git

@magyarosiR
Copy link
Author

magyarosiR commented Dec 19, 2022

Thank you for your quick solution @danwos, it is works fine locally.

I used the pip install git+https://github.com/useblocks/sphinx-test-reports@0f1ee42c8fecdca334e81009a5e89eefaf4b093f command to upgrade version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants