Skip to content

Test for the datadoc command-line tool#361

Merged
jesper-friis merged 35 commits intomasterfrom
test-for-datadoc-cli
Mar 26, 2025
Merged

Test for the datadoc command-line tool#361
jesper-friis merged 35 commits intomasterfrom
test-for-datadoc-cli

Conversation

@jesper-friis
Copy link
Contributor

@jesper-friis jesper-friis commented Mar 24, 2025

Description

Added tests for datadoc cli.

This PR also include some fixes, code restructuring and new features revealed or needed by the tests:

  • Since the tests needed a way to delete datasets, functionality for that was also added.
  • Renamed main() in the cli to maincommand() and added a new main() function that returns an integer status, which is expected by a cli.
  • Refactored search_iris() into two functions, one that creates the query and one that executes the query. Just easier for debugging...
  • Fixed some issues in search_iris(). Find IDs now works. Also ensured that sparql variables are uniquely named, even with multiple criteria.
  • Fixed some other minor typos.

The codecov report is very strange - the reported untested code lines are definitely included in the tests added in this PR. Can it be looking at an old branch? (The indicated untested code lines doesn't follow the logical flow of the code).

Type of change

  • Bug fix and code cleanup
  • New feature
  • Documentation update
  • Testing

Checklist for the reviewer

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?
  • Is the code properly tested?

@jesper-friis jesper-friis marked this pull request as draft March 24, 2025 18:44
@codecov
Copy link

codecov bot commented Mar 24, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 80.44%. Comparing base (e416d89) to head (a0c34c9).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
tripper/datadoc/clitool.py 77.77% 6 Missing ⚠️
tripper/datadoc/dataset.py 91.30% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #361      +/-   ##
==========================================
+ Coverage   78.01%   80.44%   +2.43%     
==========================================
  Files          25       25              
  Lines        2929     2971      +42     
==========================================
+ Hits         2285     2390     +105     
+ Misses        644      581      -63     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

if "=~" in crit:
key, value = crit.split("=~", 1)
regex[key] = value
else:
Copy link
Contributor Author

@jesper-friis jesper-friis Mar 26, 2025

Choose a reason for hiding this comment

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

Example of strange codecov report:

  • subcommand_delete() is definitely called by test_delete() in test_datadoc_dli.py. So line 51-53 must be covered.
  • Why can line 58 be covered when line 51-57 aren't?

@jesper-friis jesper-friis marked this pull request as ready for review March 26, 2025 07:41
@jesper-friis jesper-friis merged commit 52b6a9c into master Mar 26, 2025
19 checks passed
@jesper-friis jesper-friis deleted the test-for-datadoc-cli branch March 26, 2025 13:04
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