🐛 sphinx-test-reports: a need from a generated test file records the expanded input's line as its lineno, not the page's
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- documentation
Research direction
Start with directives/test_file.py around line 148, where self.lineno is passed to add_need, and compare with the warning-location mapping in directives/test_report.py lines 119-128. Run tests/test_need_directive_errors.py, the second-test-report-of-one-id case, to see the pinned lineno of 44. Done when every need generated from a test-report on line N reads back from needs.json with lineno N and that expectation is updated.
Written by the indexing model from the issue text.
Description
What happens
A need created from a generated test file (test-report expanding into test-file / test-suite / test-case directives) records a lineno that is not a line of the page it is on. On a ten-line page holding two test-report directives for one :id:, the kept need's lineno is 44, and since sphinx-needs #2189 a duplicate is refused with the location of the kept need, so the warning reads:
Need could not be created: A need with ID 'TR_ONE' already exists (defined at index:44).
index.rst has no line 44. The suite pins that number exactly (tests/test_need_directive_errors.py, the second-test-report-of-one-id case), so this issue's fix moves that expectation.
Why
directives/test_file.py:148 passes self.lineno to add_need, and for a directive the expansion inserted, that is its line in the EXPANDED input (the generated lines count), not the page's. directives/test_report.py:119-128 re-attributes the inserted lines' SOURCE for warnings, but the line handed to add_need is not mapped. Measured on master before #2189 as well: the need, its suite and its case all record 44.
Fix
Pass the mapped line (the test-report directive's own line on the page, which is what a reader can open) to add_need for every need the expansion creates, the way the warning location is already mapped; then update the pinned expectation to the page's line. A unit case: a page with a test-report on line N and the generated needs read back from needs.json all carry lineno == N.
- Dominant language
- Python
- Stars
- 309
- Forks
- 103
- Avg merge
- 4h 40m
- Merged PRs (30d)
- 154
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from useblocks/sphinx-needs
-
documentation pkg: sphinx-needs
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
useblocks/sphinx-needs#2379 ·
Maintainers usually reply within 1 day
-
bug pkg: sphinx-needs
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
useblocks/sphinx-needs#2338 ·
Maintainers usually reply within 1 day
-
bug pkg: sphinx-needs
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
useblocks/sphinx-needs#2335 ·
Maintainers usually reply within 1 day
-
bug pkg: sphinx-needs
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
useblocks/sphinx-needs#2332 ·
Maintainers usually reply within 1 day
-
📚 the "own service" example in docs/services/index.rst cannot be registeredPossibly taken @chrisjsewell claimed this 9 days ago. Opendocumentation pkg: sphinx-needs
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
useblocks/sphinx-needs#2327 ·
Maintainers usually reply within 1 day
All issues in useblocks/sphinx-needs
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
521xueweihan/HelloGitHub#4150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
aws-samples/sample-per-model-bedrock#595 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug connectors
Difficulty 1/5 Under an hour Newbie friendliness 67/100
pyinfra-dev/pyinfra#2036 ·
Maintainers usually reply within 9 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day