fix(rdfgen): binary-safe output with -o#2894
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2894 +/- ##
==========================================
+ Coverage 80.16% 83.66% +3.50%
==========================================
Files 131 131
Lines 15159 15165 +6
Branches 3111 3111
==========================================
+ Hits 12152 12688 +536
+ Misses 2363 1797 -566
- Partials 644 680 +36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Ostrzyciel
left a comment
There was a problem hiding this comment.
Makes sense to me and it works.
It's a bit of a hack, but I can't see how to make this better with how currently these methods are laid out. Maybe this could use a small refactor? Easiest way to clean it up would be to return bytes instead of str. But that's beyond the scope of this PR, I think.
|
Several tests failed due to network errors, as I noticed. |
That's right. But please take into account that it's probably some throttling pulling some resources. So retrying too many and too quickly might end up with the same result. Just be patient and retry after some time, not straightaway. |
I would also go for small-scoped PRs adding improvements/clean-ups/optimizations on a separate PR. |
Binary RDF serializers (e.g., Jelly) could raise a UnicodeDecodeError when writing to stdout.
With -o/--output, rdfgen now lets RDFLib write directly to the file (Graph.serialize with destination).
Binary serializers write to the file, leaving stdout empty.
Behaviour without -o is unchanged.
Tests:
Unit: mock Graph.serialize; verify file writing, empty stdout, and ttl still maps to turtle.
Integration: run with Jelly if available; check empty stdout and binary file output.