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

🧪 Add test for needreport directive #1105

Merged
merged 3 commits into from
Feb 12, 2024
Merged

🧪 Add test for needreport directive #1105

merged 3 commits into from
Feb 12, 2024

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Feb 9, 2024

Currently there is no test for this directive, this PR adds one.

This PR also fixes the directive:

  • Make the options flags
  • Change errors in the directive to emit warnings, rather than excepting the whole build
  • Allow for template to be specified as a directive option
  • Allow the the dropdown directive used in the default template, which requires an external sphinx extension, to be overriden using needs_render_context = {"report_directive": "admonition"} (I left the default as dropdown, so as not to introduce a breaking change)

@chrisjsewell chrisjsewell requested a review from danwos February 9, 2024 12:18
Copy link

codecov bot commented Feb 9, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (73b961e) 83.19% compared to head (418f209) 83.86%.

Files Patch % Lines
sphinx_needs/directives/needreport.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1105      +/-   ##
==========================================
+ Coverage   83.19%   83.86%   +0.66%     
==========================================
  Files          56       56              
  Lines        6456     6438      -18     
==========================================
+ Hits         5371     5399      +28     
+ Misses       1085     1039      -46     
Flag Coverage Δ
pytests 83.86% <93.33%> (+0.66%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chrisjsewell
Copy link
Member Author

I've also just realised there is a bug in this directive:
The usage flag creates a count of user defined need types.
However, it does this during the processing of the directive, rather than in a post-processing step.
Therefore, the count will usually be incorrect.

Copy link
Member

@danwos danwos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THanks for the PR and the fixes 👍

@danwos danwos merged commit 6abd389 into master Feb 12, 2024
19 checks passed
@danwos danwos deleted the test-needreport branch February 12, 2024 08:36
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 this pull request may close these issues.

2 participants