This is an automated email from the ASF dual-hosted git repository.

akitouni pushed a commit to branch abderrahim/roundtrip
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 6258d8936f44c12940be586d93e7c6c409cd6582
Author: Abderrahim Kitouni <[email protected]>
AuthorDate: Mon Aug 25 14:32:58 2025 +0100

    _yaml: set a large 'width' value in the roundtrip yaml config
    
    At some point, ruamel-yaml started line wrapping at 80 columns, breaking our
    'roundtrip' promise
---
 src/buildstream/_yaml.pyx                | 2 ++
 tests/internals/yaml/roundtrip-test.yaml | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/buildstream/_yaml.pyx b/src/buildstream/_yaml.pyx
index cc8da6aa7..c962bb881 100644
--- a/src/buildstream/_yaml.pyx
+++ b/src/buildstream/_yaml.pyx
@@ -389,6 +389,8 @@ 
yaml.RoundTripConstructor.add_constructor(u'tag:yaml.org,2002:timestamp',
 def prepare_roundtrip_yaml():
     yml = yaml.YAML()
     yml.preserve_quotes=True
+    # defaults to 80 if we don't set it
+    yml.width=9999
 
     # For each of YAML 1.1 and 1.2, force everything to be a plain string
 
diff --git a/tests/internals/yaml/roundtrip-test.yaml 
b/tests/internals/yaml/roundtrip-test.yaml
index 2e3f5c721..c81b86020 100644
--- a/tests/internals/yaml/roundtrip-test.yaml
+++ b/tests/internals/yaml/roundtrip-test.yaml
@@ -51,5 +51,7 @@ nullcheck: null
 
 timestamp: 2019-03-14
 
+long-string: Sometimes very long strings get truncated by ruamel-yaml because 
the default width is set to 80.
+
 # That is all
 

Reply via email to