summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-06-28 17:01:23 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-07-01 22:38:48 +0100
commit947fbd8bedb93185ff69db35fd3dce22efc80e8a (patch)
tree0921647eb10732bb243092cba3ac50d75f488382
parentd96c1a232b0cd41558e75aac10dc3badb9361594 (diff)
downloadbuildstream-947fbd8bedb93185ff69db35fd3dce22efc80e8a.tar.gz
tests: Change all calls to _yaml.dump to _yaml.rountrip_dump
Now that both are equivalent, we can skip the sanitization part before the yaml call.
-rw-r--r--src/buildstream/testing/_sourcetests/build_checkout.py5
-rw-r--r--src/buildstream/testing/_sourcetests/fetch.py7
-rw-r--r--src/buildstream/testing/_sourcetests/mirror.py32
-rw-r--r--src/buildstream/testing/_sourcetests/source_determinism.py2
-rw-r--r--src/buildstream/testing/_sourcetests/track.py10
-rw-r--r--src/buildstream/testing/_sourcetests/track_cross_junction.py6
-rw-r--r--src/buildstream/testing/_sourcetests/workspace.py5
-rw-r--r--src/buildstream/testing/_utils/__init__.py2
-rw-r--r--src/buildstream/testing/_utils/junction.py2
-rw-r--r--src/buildstream/testing/runcli.py4
-rw-r--r--tests/artifactcache/cache_size.py4
-rw-r--r--tests/artifactcache/config.py6
-rw-r--r--tests/artifactcache/junctions.py2
-rw-r--r--tests/artifactcache/pull.py4
-rw-r--r--tests/artifactcache/push.py4
-rw-r--r--tests/cachekey/cachekey.py4
-rw-r--r--tests/elements/filter.py44
-rw-r--r--tests/format/include.py4
-rw-r--r--tests/format/include_composition.py87
-rw-r--r--tests/format/junctions.py8
-rw-r--r--tests/format/project.py2
-rw-r--r--tests/format/variables.py10
-rw-r--r--tests/frontend/__init__.py2
-rw-r--r--tests/frontend/buildcheckout.py24
-rw-r--r--tests/frontend/buildtrack.py6
-rw-r--r--tests/frontend/configurable_warnings.py2
-rw-r--r--tests/frontend/cross_junction_workspace.py16
-rw-r--r--tests/frontend/fetch.py11
-rw-r--r--tests/frontend/logging.py12
-rw-r--r--tests/frontend/mirror.py34
-rw-r--r--tests/frontend/order.py2
-rw-r--r--tests/frontend/overlaps.py2
-rw-r--r--tests/frontend/remote-caches.py2
-rw-r--r--tests/frontend/show.py10
-rw-r--r--tests/frontend/source_checkout.py2
-rw-r--r--tests/frontend/track.py8
-rw-r--r--tests/frontend/workspace.py30
-rw-r--r--tests/integration/cachedfail.py10
-rw-r--r--tests/integration/compose.py2
-rw-r--r--tests/integration/import.py2
-rw-r--r--tests/integration/manual.py2
-rw-r--r--tests/integration/messages.py4
-rw-r--r--tests/integration/pip_element.py4
-rw-r--r--tests/integration/pip_source.py6
-rw-r--r--tests/integration/script.py2
-rw-r--r--tests/integration/shell.py2
-rw-r--r--tests/integration/source-determinism.py2
-rw-r--r--tests/integration/workspace.py16
-rw-r--r--tests/sandboxes/missing_dependencies.py4
-rw-r--r--tests/sandboxes/remote-exec-config.py6
-rw-r--r--tests/sourcecache/cache.py2
-rw-r--r--tests/sourcecache/config.py2
-rw-r--r--tests/sourcecache/fetch.py12
-rw-r--r--tests/sourcecache/push.py14
-rw-r--r--tests/sources/bzr.py2
-rw-r--r--tests/sources/deb.py2
-rw-r--r--tests/sources/git.py66
-rw-r--r--tests/sources/local.py2
-rw-r--r--tests/sources/no_fetch_cached.py2
-rw-r--r--tests/sources/pip.py2
-rw-r--r--tests/sources/previous_source_access.py2
-rw-r--r--tests/sources/remote.py4
-rw-r--r--tests/sources/tar.py4
-rw-r--r--tests/sources/zip.py4
-rw-r--r--tests/testutils/element_generators.py2
-rw-r--r--tests/testutils/junction.py2
66 files changed, 292 insertions, 311 deletions
diff --git a/src/buildstream/testing/_sourcetests/build_checkout.py b/src/buildstream/testing/_sourcetests/build_checkout.py
index 3619d2b7e..e2842e0e0 100644
--- a/src/buildstream/testing/_sourcetests/build_checkout.py
+++ b/src/buildstream/testing/_sourcetests/build_checkout.py
@@ -63,9 +63,8 @@ def test_fetch_build_checkout(cli, tmpdir, datafiles, strict, kind):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
assert cli.get_element_state(project, element_name) == 'fetch needed'
result = cli.run(project=project, args=strict_args(['build', element_name], strict))
diff --git a/src/buildstream/testing/_sourcetests/fetch.py b/src/buildstream/testing/_sourcetests/fetch.py
index aaf92a14d..d9b0876c6 100644
--- a/src/buildstream/testing/_sourcetests/fetch.py
+++ b/src/buildstream/testing/_sourcetests/fetch.py
@@ -53,9 +53,8 @@ def test_fetch(cli, tmpdir, datafiles, kind):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
# Assert that a fetch is needed
assert cli.get_element_state(project, element_name) == 'fetch needed'
@@ -89,7 +88,7 @@ def test_fetch_cross_junction(cli, tmpdir, datafiles, ref_storage, kind):
repo.source_config(ref=(ref if ref_storage == 'inline' else None))
]
}
- _yaml.dump(element, import_etc_path)
+ _yaml.roundtrip_dump(element, import_etc_path)
configure_project(project, {
'ref-storage': ref_storage
diff --git a/src/buildstream/testing/_sourcetests/mirror.py b/src/buildstream/testing/_sourcetests/mirror.py
index afbadbef7..f532049dd 100644
--- a/src/buildstream/testing/_sourcetests/mirror.py
+++ b/src/buildstream/testing/_sourcetests/mirror.py
@@ -66,7 +66,7 @@ def test_mirror_fetch(cli, tmpdir, datafiles, kind):
full_mirror = mirror_repo.source_config()['url']
mirror_map, _ = os.path.split(full_mirror)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project = {
'name': 'test',
@@ -84,7 +84,7 @@ def test_mirror_fetch(cli, tmpdir, datafiles, kind):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
# No obvious ways of checking that the mirror has been fetched
# But at least we can be sure it succeeds
@@ -124,7 +124,7 @@ def test_mirror_fetch_upstream_absent(cli, tmpdir, datafiles, kind):
full_mirror = mirror_repo.source_config()['url']
mirror_map, _ = os.path.split(full_mirror)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project = {
'name': 'test',
@@ -142,7 +142,7 @@ def test_mirror_fetch_upstream_absent(cli, tmpdir, datafiles, kind):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
result = cli.run(project=project_dir, args=['source', 'fetch', element_name])
result.assert_success()
@@ -179,14 +179,14 @@ def test_mirror_from_includes(cli, tmpdir, datafiles, kind):
full_mirror = mirror_repo.source_config()['url']
mirror_map, _ = os.path.split(full_mirror)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
config_project_dir = str(tmpdir.join('config'))
os.makedirs(config_project_dir, exist_ok=True)
config_project = {
'name': 'config'
}
- _yaml.dump(config_project, os.path.join(config_project_dir, 'project.conf'))
+ _yaml.roundtrip_dump(config_project, os.path.join(config_project_dir, 'project.conf'))
extra_mirrors = {
'mirrors': [
{
@@ -197,7 +197,7 @@ def test_mirror_from_includes(cli, tmpdir, datafiles, kind):
}
]
}
- _yaml.dump(extra_mirrors, os.path.join(config_project_dir, 'mirrors.yml'))
+ _yaml.roundtrip_dump(extra_mirrors, os.path.join(config_project_dir, 'mirrors.yml'))
generate_junction(str(tmpdir.join('config_repo')),
config_project_dir,
os.path.join(element_dir, 'config.bst'))
@@ -213,7 +213,7 @@ def test_mirror_from_includes(cli, tmpdir, datafiles, kind):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
# Now make the upstream unavailable.
os.rename(upstream_repo.repo, '{}.bak'.format(upstream_repo.repo))
@@ -252,14 +252,14 @@ def test_mirror_junction_from_includes(cli, tmpdir, datafiles, kind):
full_mirror = mirror_repo.source_config()['url']
mirror_map, _ = os.path.split(full_mirror)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
config_project_dir = str(tmpdir.join('config'))
os.makedirs(config_project_dir, exist_ok=True)
config_project = {
'name': 'config'
}
- _yaml.dump(config_project, os.path.join(config_project_dir, 'project.conf'))
+ _yaml.roundtrip_dump(config_project, os.path.join(config_project_dir, 'project.conf'))
extra_mirrors = {
'mirrors': [
{
@@ -270,7 +270,7 @@ def test_mirror_junction_from_includes(cli, tmpdir, datafiles, kind):
}
]
}
- _yaml.dump(extra_mirrors, os.path.join(config_project_dir, 'mirrors.yml'))
+ _yaml.roundtrip_dump(extra_mirrors, os.path.join(config_project_dir, 'mirrors.yml'))
generate_junction(str(tmpdir.join('config_repo')),
config_project_dir,
os.path.join(element_dir, 'config.bst'))
@@ -286,7 +286,7 @@ def test_mirror_junction_from_includes(cli, tmpdir, datafiles, kind):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
# Now make the upstream unavailable.
os.rename(upstream_repo.repo, '{}.bak'.format(upstream_repo.repo))
@@ -332,7 +332,7 @@ def test_mirror_track_upstream_present(cli, tmpdir, datafiles, kind):
full_mirror = mirror_repo.source_config()['url']
mirror_map, _ = os.path.split(full_mirror)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project = {
'name': 'test',
@@ -350,7 +350,7 @@ def test_mirror_track_upstream_present(cli, tmpdir, datafiles, kind):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
result = cli.run(project=project_dir, args=['source', 'track', element_name])
result.assert_success()
@@ -397,7 +397,7 @@ def test_mirror_track_upstream_absent(cli, tmpdir, datafiles, kind):
full_mirror = mirror_repo.source_config()['url']
mirror_map, _ = os.path.split(full_mirror)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project = {
'name': 'test',
@@ -415,7 +415,7 @@ def test_mirror_track_upstream_absent(cli, tmpdir, datafiles, kind):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
result = cli.run(project=project_dir, args=['source', 'track', element_name])
result.assert_success()
diff --git a/src/buildstream/testing/_sourcetests/source_determinism.py b/src/buildstream/testing/_sourcetests/source_determinism.py
index 3a5c264d9..fc8ad9893 100644
--- a/src/buildstream/testing/_sourcetests/source_determinism.py
+++ b/src/buildstream/testing/_sourcetests/source_determinism.py
@@ -91,7 +91,7 @@ def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
]
}
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
def get_value_for_umask(umask):
checkoutdir = os.path.join(str(tmpdir), 'checkout-{}'.format(umask))
diff --git a/src/buildstream/testing/_sourcetests/track.py b/src/buildstream/testing/_sourcetests/track.py
index 58679e9f1..01a39951f 100644
--- a/src/buildstream/testing/_sourcetests/track.py
+++ b/src/buildstream/testing/_sourcetests/track.py
@@ -43,7 +43,7 @@ def generate_element(repo, element_path, dep_name=None):
if dep_name:
element['depends'] = [dep_name]
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
@pytest.mark.datafiles(DATA_DIR)
@@ -290,8 +290,8 @@ def test_track_include(cli, tmpdir, datafiles, ref_storage, kind):
]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
- _yaml.dump(sources, os.path.join(element_path, 'sources.yml'))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(sources, os.path.join(element_path, 'sources.yml'))
# Assert that a fetch is needed
assert cli.get_element_state(project, element_name) == 'no reference'
@@ -363,8 +363,8 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind):
]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
- _yaml.dump(sources, os.path.join(sub_element_path, 'sources.yml'))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(sources, os.path.join(sub_element_path, 'sources.yml'))
generate_junction(str(tmpdir.join('junction_repo')),
subproject_path, junction_path, store_ref=True)
diff --git a/src/buildstream/testing/_sourcetests/track_cross_junction.py b/src/buildstream/testing/_sourcetests/track_cross_junction.py
index ece3e0b8f..31443bdf9 100644
--- a/src/buildstream/testing/_sourcetests/track_cross_junction.py
+++ b/src/buildstream/testing/_sourcetests/track_cross_junction.py
@@ -42,7 +42,7 @@ def generate_element(repo, element_path, dep_name=None):
if dep_name:
element['depends'] = [dep_name]
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
def generate_import_element(tmpdir, kind, project, name):
@@ -75,7 +75,7 @@ def generate_project(tmpdir, name, config=None):
'element-path': 'elements'
}
project_conf.update(config)
- _yaml.dump(project_conf, os.path.join(subproject_path, 'project.conf'))
+ _yaml.roundtrip_dump(project_conf, os.path.join(subproject_path, 'project.conf'))
return project_name, subproject_path
@@ -87,7 +87,7 @@ def generate_simple_stack(project, name, dependencies):
'kind': 'stack',
'depends': dependencies
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
return element_name
diff --git a/src/buildstream/testing/_sourcetests/workspace.py b/src/buildstream/testing/_sourcetests/workspace.py
index 5218f8f1e..5ceab5108 100644
--- a/src/buildstream/testing/_sourcetests/workspace.py
+++ b/src/buildstream/testing/_sourcetests/workspace.py
@@ -73,9 +73,8 @@ class WorkspaceCreator():
}
if element_attrs:
element = {**element, **element_attrs}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
return element_name, element_path, workspace_dir
def create_workspace_elements(self, kinds, track, suffixs=None, workspace_dir_usr=None,
diff --git a/src/buildstream/testing/_utils/__init__.py b/src/buildstream/testing/_utils/__init__.py
index b419d72b7..575226e22 100644
--- a/src/buildstream/testing/_utils/__init__.py
+++ b/src/buildstream/testing/_utils/__init__.py
@@ -7,4 +7,4 @@ from .junction import generate_junction
def configure_project(path, config):
config['name'] = 'test'
config['element-path'] = 'elements'
- _yaml.dump(config, os.path.join(path, 'project.conf'))
+ _yaml.roundtrip_dump(config, os.path.join(path, 'project.conf'))
diff --git a/src/buildstream/testing/_utils/junction.py b/src/buildstream/testing/_utils/junction.py
index 2bf53ac7c..98d23b0a2 100644
--- a/src/buildstream/testing/_utils/junction.py
+++ b/src/buildstream/testing/_utils/junction.py
@@ -34,7 +34,7 @@ def generate_junction(tmpdir, subproject_path, junction_path, *, store_ref=True)
repo.source_config(ref=source_ref)
]
}
- _yaml.dump(element, junction_path)
+ _yaml.roundtrip_dump(element, junction_path)
return ref
diff --git a/src/buildstream/testing/runcli.py b/src/buildstream/testing/runcli.py
index a77deeb9e..16593fa8e 100644
--- a/src/buildstream/testing/runcli.py
+++ b/src/buildstream/testing/runcli.py
@@ -576,7 +576,7 @@ class CliIntegration(Cli):
_yaml.composite_dict(base_config, project_config)
- _yaml.dump(base_config, project_filename)
+ _yaml.roundtrip_dump(base_config, project_filename)
else:
@@ -887,6 +887,6 @@ def configured(directory, config=None):
# Dump it and yield the filename for test scripts to feed it
# to buildstream as an artument
filename = os.path.join(directory, "buildstream.conf")
- _yaml.dump(config, filename)
+ _yaml.roundtrip_dump(config, filename)
yield filename
diff --git a/tests/artifactcache/cache_size.py b/tests/artifactcache/cache_size.py
index 3a2956c5c..fb34b5fad 100644
--- a/tests/artifactcache/cache_size.py
+++ b/tests/artifactcache/cache_size.py
@@ -22,7 +22,7 @@ def create_project(project_dir):
project_conf = {
"name": "test"
}
- _yaml.dump(project_conf, project_file)
+ _yaml.roundtrip_dump(project_conf, project_file)
element_name = "test.bst"
create_element_size(element_name, project_dir, ".", [], 1024)
@@ -77,7 +77,7 @@ def test_quota_over_1024T(cli, tmpdir):
})
project = tmpdir.join("main")
os.makedirs(str(project))
- _yaml.dump({'name': 'main'}, str(project.join("project.conf")))
+ _yaml.roundtrip_dump({'name': 'main'}, str(project.join("project.conf")))
volume_space_patch = mock.patch(
"buildstream._cas.CASQuota._get_cache_volume_size",
diff --git a/tests/artifactcache/config.py b/tests/artifactcache/config.py
index 928a6c524..db51d196c 100644
--- a/tests/artifactcache/config.py
+++ b/tests/artifactcache/config.py
@@ -101,11 +101,11 @@ def test_artifact_cache_precedence(tmpdir, override_caches, project_caches, user
project_config['name'] = 'test'
user_config_file = str(tmpdir.join('buildstream.conf'))
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
project_dir = tmpdir.mkdir('project')
project_config_file = str(project_dir.join('project.conf'))
- _yaml.dump(project_config, filename=project_config_file)
+ _yaml.roundtrip_dump(project_config, file=project_config_file)
context = Context()
context.load(config=user_config_file)
@@ -141,7 +141,7 @@ def test_missing_certs(cli, datafiles, config_key, config_value):
}
}
project_conf_file = os.path.join(project, 'project.conf')
- _yaml.dump(project_conf, project_conf_file)
+ _yaml.roundtrip_dump(project_conf, project_conf_file)
# Use `pull` here to ensure we try to initialize the remotes, triggering the error
#
diff --git a/tests/artifactcache/junctions.py b/tests/artifactcache/junctions.py
index f099ee566..6170816c3 100644
--- a/tests/artifactcache/junctions.py
+++ b/tests/artifactcache/junctions.py
@@ -24,7 +24,7 @@ def project_set_artifacts(project, url):
'url': url,
'push': True
}
- _yaml.dump(project_config, filename=project_conf_file)
+ _yaml.roundtrip_dump(project_config.strip_node_info(), file=project_conf_file)
@pytest.mark.datafiles(DATA_DIR)
diff --git a/tests/artifactcache/pull.py b/tests/artifactcache/pull.py
index 0b57a6c9a..d5da39a99 100644
--- a/tests/artifactcache/pull.py
+++ b/tests/artifactcache/pull.py
@@ -73,7 +73,7 @@ def test_pull(cli, tmpdir, datafiles):
}
# Write down the user configuration file
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
# Ensure CLI calls will use it
cli.configure(user_config)
@@ -182,7 +182,7 @@ def test_pull_tree(cli, tmpdir, datafiles):
}
# Write down the user configuration file
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
# Ensure CLI calls will use it
cli.configure(user_config)
diff --git a/tests/artifactcache/push.py b/tests/artifactcache/push.py
index 862393f35..fd9758229 100644
--- a/tests/artifactcache/push.py
+++ b/tests/artifactcache/push.py
@@ -66,7 +66,7 @@ def test_push(cli, tmpdir, datafiles):
}
# Write down the user configuration file
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
# Fake minimal context
context = Context()
@@ -164,7 +164,7 @@ def test_push_message(tmpdir, datafiles):
}
# Write down the user configuration file
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
queue = multiprocessing.Queue()
# Use subprocess to avoid creation of gRPC threads in main BuildStream process
diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py
index bbececb8c..acfe97947 100644
--- a/tests/cachekey/cachekey.py
+++ b/tests/cachekey/cachekey.py
@@ -198,11 +198,11 @@ def test_cache_key_fatal_warnings(cli, tmpdir, first_warnings, second_warnings,
project_dir = tmpdir.mkdir(project_name)
project_config_file = str(project_dir.join('project.conf'))
- _yaml.dump(config, filename=project_config_file)
+ _yaml.roundtrip_dump(config, file=project_config_file)
elem_dir = project_dir.mkdir('elements')
element_file = str(elem_dir.join('stack.bst'))
- _yaml.dump({'kind': 'stack'}, filename=element_file)
+ _yaml.roundtrip_dump({'kind': 'stack'}, file=element_file)
result = cli.run(project=str(project_dir), args=[
'show',
diff --git a/tests/elements/filter.py b/tests/elements/filter.py
index f9c80afff..db20529bc 100644
--- a/tests/elements/filter.py
+++ b/tests/elements/filter.py
@@ -202,7 +202,7 @@ def test_filter_track(datafiles, cli, tmpdir):
"element-path": "elements",
}
project_file = os.path.join(str(tmpdir), "project.conf")
- _yaml.dump(project_config, project_file)
+ _yaml.roundtrip_dump(project_config, project_file)
input_config = {
"kind": "import",
@@ -210,7 +210,7 @@ def test_filter_track(datafiles, cli, tmpdir):
}
input_file = os.path.join(elements_dir, input_name)
- _yaml.dump(input_config, input_file)
+ _yaml.roundtrip_dump(input_config, input_file)
filter1_config = {
"kind": "filter",
@@ -219,7 +219,7 @@ def test_filter_track(datafiles, cli, tmpdir):
]
}
filter1_file = os.path.join(elements_dir, "filter1.bst")
- _yaml.dump(filter1_config, filter1_file)
+ _yaml.roundtrip_dump(filter1_config, filter1_file)
filter2_config = {
"kind": "filter",
@@ -228,7 +228,7 @@ def test_filter_track(datafiles, cli, tmpdir):
]
}
filter2_file = os.path.join(elements_dir, "filter2.bst")
- _yaml.dump(filter2_config, filter2_file)
+ _yaml.roundtrip_dump(filter2_config, filter2_file)
# Assert that a fetch is needed
assert cli.get_element_state(project, input_name) == 'no reference'
@@ -257,7 +257,7 @@ def test_filter_track_excepted(datafiles, cli, tmpdir):
"element-path": "elements",
}
project_file = os.path.join(str(tmpdir), "project.conf")
- _yaml.dump(project_config, project_file)
+ _yaml.roundtrip_dump(project_config, project_file)
input_config = {
"kind": "import",
@@ -265,7 +265,7 @@ def test_filter_track_excepted(datafiles, cli, tmpdir):
}
input_file = os.path.join(elements_dir, input_name)
- _yaml.dump(input_config, input_file)
+ _yaml.roundtrip_dump(input_config, input_file)
filter1_config = {
"kind": "filter",
@@ -274,7 +274,7 @@ def test_filter_track_excepted(datafiles, cli, tmpdir):
]
}
filter1_file = os.path.join(elements_dir, "filter1.bst")
- _yaml.dump(filter1_config, filter1_file)
+ _yaml.roundtrip_dump(filter1_config, filter1_file)
filter2_config = {
"kind": "filter",
@@ -283,7 +283,7 @@ def test_filter_track_excepted(datafiles, cli, tmpdir):
]
}
filter2_file = os.path.join(elements_dir, "filter2.bst")
- _yaml.dump(filter2_config, filter2_file)
+ _yaml.roundtrip_dump(filter2_config, filter2_file)
# Assert that a fetch is needed
assert cli.get_element_state(project, input_name) == 'no reference'
@@ -311,7 +311,7 @@ def test_filter_track_multi_to_one(datafiles, cli, tmpdir):
"element-path": "elements",
}
project_file = os.path.join(str(tmpdir), "project.conf")
- _yaml.dump(project_config, project_file)
+ _yaml.roundtrip_dump(project_config, project_file)
input_config = {
"kind": "import",
@@ -319,7 +319,7 @@ def test_filter_track_multi_to_one(datafiles, cli, tmpdir):
}
input_file = os.path.join(elements_dir, input_name)
- _yaml.dump(input_config, input_file)
+ _yaml.roundtrip_dump(input_config, input_file)
filter1_config = {
"kind": "filter",
@@ -328,7 +328,7 @@ def test_filter_track_multi_to_one(datafiles, cli, tmpdir):
]
}
filter1_file = os.path.join(elements_dir, "filter1.bst")
- _yaml.dump(filter1_config, filter1_file)
+ _yaml.roundtrip_dump(filter1_config, filter1_file)
filter2_config = {
"kind": "filter",
@@ -337,7 +337,7 @@ def test_filter_track_multi_to_one(datafiles, cli, tmpdir):
]
}
filter2_file = os.path.join(elements_dir, "filter2.bst")
- _yaml.dump(filter2_config, filter2_file)
+ _yaml.roundtrip_dump(filter2_config, filter2_file)
# Assert that a fetch is needed
assert cli.get_element_state(project, input_name) == 'no reference'
@@ -367,7 +367,7 @@ def test_filter_track_multi(datafiles, cli, tmpdir):
"element-path": "elements",
}
project_file = os.path.join(str(tmpdir), "project.conf")
- _yaml.dump(project_config, project_file)
+ _yaml.roundtrip_dump(project_config, project_file)
input_config = {
"kind": "import",
@@ -375,11 +375,11 @@ def test_filter_track_multi(datafiles, cli, tmpdir):
}
input_file = os.path.join(elements_dir, input_name)
- _yaml.dump(input_config, input_file)
+ _yaml.roundtrip_dump(input_config, input_file)
input2_config = dict(input_config)
input2_file = os.path.join(elements_dir, input2_name)
- _yaml.dump(input2_config, input2_file)
+ _yaml.roundtrip_dump(input2_config, input2_file)
filter1_config = {
"kind": "filter",
@@ -388,7 +388,7 @@ def test_filter_track_multi(datafiles, cli, tmpdir):
]
}
filter1_file = os.path.join(elements_dir, "filter1.bst")
- _yaml.dump(filter1_config, filter1_file)
+ _yaml.roundtrip_dump(filter1_config, filter1_file)
filter2_config = {
"kind": "filter",
@@ -397,7 +397,7 @@ def test_filter_track_multi(datafiles, cli, tmpdir):
]
}
filter2_file = os.path.join(elements_dir, "filter2.bst")
- _yaml.dump(filter2_config, filter2_file)
+ _yaml.roundtrip_dump(filter2_config, filter2_file)
# Assert that a fetch is needed
states = cli.get_element_states(project, [input_name, input2_name])
@@ -437,7 +437,7 @@ def test_filter_track_multi_exclude(datafiles, cli, tmpdir):
"element-path": "elements",
}
project_file = os.path.join(str(tmpdir), "project.conf")
- _yaml.dump(project_config, project_file)
+ _yaml.roundtrip_dump(project_config, project_file)
input_config = {
"kind": "import",
@@ -445,11 +445,11 @@ def test_filter_track_multi_exclude(datafiles, cli, tmpdir):
}
input_file = os.path.join(elements_dir, input_name)
- _yaml.dump(input_config, input_file)
+ _yaml.roundtrip_dump(input_config, input_file)
input2_config = dict(input_config)
input2_file = os.path.join(elements_dir, input2_name)
- _yaml.dump(input2_config, input2_file)
+ _yaml.roundtrip_dump(input2_config, input2_file)
filter1_config = {
"kind": "filter",
@@ -458,7 +458,7 @@ def test_filter_track_multi_exclude(datafiles, cli, tmpdir):
]
}
filter1_file = os.path.join(elements_dir, "filter1.bst")
- _yaml.dump(filter1_config, filter1_file)
+ _yaml.roundtrip_dump(filter1_config, filter1_file)
filter2_config = {
"kind": "filter",
@@ -467,7 +467,7 @@ def test_filter_track_multi_exclude(datafiles, cli, tmpdir):
]
}
filter2_file = os.path.join(elements_dir, "filter2.bst")
- _yaml.dump(filter2_config, filter2_file)
+ _yaml.roundtrip_dump(filter2_config, filter2_file)
# Assert that a fetch is needed
states = cli.get_element_states(project, [input_name, input2_name])
diff --git a/tests/format/include.py b/tests/format/include.py
index e2e16c34a..3bb4e4d51 100644
--- a/tests/format/include.py
+++ b/tests/format/include.py
@@ -126,7 +126,7 @@ def test_junction_element_partial_project_project(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, junction_path)
+ _yaml.roundtrip_dump(element, junction_path)
result = cli.run(project=project, args=[
'show',
@@ -159,7 +159,7 @@ def test_junction_element_not_partial_project_file(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, junction_path)
+ _yaml.roundtrip_dump(element, junction_path)
result = cli.run(project=project, args=[
'show',
diff --git a/tests/format/include_composition.py b/tests/format/include_composition.py
index b922c7a0e..f764b16a6 100644
--- a/tests/format/include_composition.py
+++ b/tests/format/include_composition.py
@@ -6,8 +6,7 @@ from buildstream import _yaml
def make_includes(basedir):
- _yaml.dump({'name': 'test'},
- os.path.join(basedir, 'project.conf'))
+ _yaml.roundtrip_dump({'name': 'test'}, os.path.join(basedir, 'project.conf'))
context = Context()
project = Project(basedir, context)
loader = project.loader
@@ -17,14 +16,12 @@ def make_includes(basedir):
def test_main_has_priority(tmpdir):
includes = make_includes(str(tmpdir))
- _yaml.dump({'(@)': ['a.yml'],
- 'test': ['main']},
- str(tmpdir.join('main.yml')))
+ _yaml.roundtrip_dump({'(@)': ['a.yml'], 'test': ['main']},
+ str(tmpdir.join('main.yml')))
main = _yaml.load(str(tmpdir.join('main.yml')))
- _yaml.dump({'test': ['a']},
- str(tmpdir.join('a.yml')))
+ _yaml.roundtrip_dump({'test': ['a']}, str(tmpdir.join('a.yml')))
includes.process(main)
@@ -34,13 +31,12 @@ def test_main_has_priority(tmpdir):
def test_include_cannot_append(tmpdir):
includes = make_includes(str(tmpdir))
- _yaml.dump({'(@)': ['a.yml'],
- 'test': ['main']},
- str(tmpdir.join('main.yml')))
+ _yaml.roundtrip_dump({'(@)': ['a.yml'], 'test': ['main']},
+ str(tmpdir.join('main.yml')))
main = _yaml.load(str(tmpdir.join('main.yml')))
- _yaml.dump({'test': {'(>)': ['a']}},
- str(tmpdir.join('a.yml')))
+ _yaml.roundtrip_dump({'test': {'(>)': ['a']}},
+ str(tmpdir.join('a.yml')))
includes.process(main)
@@ -50,13 +46,11 @@ def test_include_cannot_append(tmpdir):
def test_main_can_append(tmpdir):
includes = make_includes(str(tmpdir))
- _yaml.dump({'(@)': ['a.yml'],
- 'test': {'(>)': ['main']}},
- str(tmpdir.join('main.yml')))
+ _yaml.roundtrip_dump({'(@)': ['a.yml'], 'test': {'(>)': ['main']}},
+ str(tmpdir.join('main.yml')))
main = _yaml.load(str(tmpdir.join('main.yml')))
- _yaml.dump({'test': ['a']},
- str(tmpdir.join('a.yml')))
+ _yaml.roundtrip_dump({'test': ['a']}, str(tmpdir.join('a.yml')))
includes.process(main)
@@ -66,14 +60,14 @@ def test_main_can_append(tmpdir):
def test_sibling_cannot_append_backward(tmpdir):
includes = make_includes(str(tmpdir))
- _yaml.dump({'(@)': ['a.yml', 'b.yml']},
- str(tmpdir.join('main.yml')))
+ _yaml.roundtrip_dump({'(@)': ['a.yml', 'b.yml']},
+ str(tmpdir.join('main.yml')))
main = _yaml.load(str(tmpdir.join('main.yml')))
- _yaml.dump({'test': {'(>)': ['a']}},
- str(tmpdir.join('a.yml')))
- _yaml.dump({'test': ['b']},
- str(tmpdir.join('b.yml')))
+ _yaml.roundtrip_dump({'test': {'(>)': ['a']}},
+ str(tmpdir.join('a.yml')))
+ _yaml.roundtrip_dump({'test': ['b']},
+ str(tmpdir.join('b.yml')))
includes.process(main)
@@ -83,14 +77,14 @@ def test_sibling_cannot_append_backward(tmpdir):
def test_sibling_can_append_forward(tmpdir):
includes = make_includes(str(tmpdir))
- _yaml.dump({'(@)': ['a.yml', 'b.yml']},
- str(tmpdir.join('main.yml')))
+ _yaml.roundtrip_dump({'(@)': ['a.yml', 'b.yml']},
+ str(tmpdir.join('main.yml')))
main = _yaml.load(str(tmpdir.join('main.yml')))
- _yaml.dump({'test': ['a']},
- str(tmpdir.join('a.yml')))
- _yaml.dump({'test': {'(>)': ['b']}},
- str(tmpdir.join('b.yml')))
+ _yaml.roundtrip_dump({'test': ['a']},
+ str(tmpdir.join('a.yml')))
+ _yaml.roundtrip_dump({'test': {'(>)': ['b']}},
+ str(tmpdir.join('b.yml')))
includes.process(main)
@@ -100,14 +94,14 @@ def test_sibling_can_append_forward(tmpdir):
def test_lastest_sibling_has_priority(tmpdir):
includes = make_includes(str(tmpdir))
- _yaml.dump({'(@)': ['a.yml', 'b.yml']},
- str(tmpdir.join('main.yml')))
+ _yaml.roundtrip_dump({'(@)': ['a.yml', 'b.yml']},
+ str(tmpdir.join('main.yml')))
main = _yaml.load(str(tmpdir.join('main.yml')))
- _yaml.dump({'test': ['a']},
- str(tmpdir.join('a.yml')))
- _yaml.dump({'test': ['b']},
- str(tmpdir.join('b.yml')))
+ _yaml.roundtrip_dump({'test': ['a']},
+ str(tmpdir.join('a.yml')))
+ _yaml.roundtrip_dump({'test': ['b']},
+ str(tmpdir.join('b.yml')))
includes.process(main)
@@ -117,13 +111,11 @@ def test_lastest_sibling_has_priority(tmpdir):
def test_main_keeps_keys(tmpdir):
includes = make_includes(str(tmpdir))
- _yaml.dump({'(@)': ['a.yml'],
- 'something': 'else'},
- str(tmpdir.join('main.yml')))
+ _yaml.roundtrip_dump({'(@)': ['a.yml'], 'something': 'else'},
+ str(tmpdir.join('main.yml')))
main = _yaml.load(str(tmpdir.join('main.yml')))
- _yaml.dump({'test': ['a']},
- str(tmpdir.join('a.yml')))
+ _yaml.roundtrip_dump({'test': ['a']}, str(tmpdir.join('a.yml')))
includes.process(main)
@@ -134,20 +126,19 @@ def test_main_keeps_keys(tmpdir):
def test_overwrite_directive_on_later_composite(tmpdir):
includes = make_includes(str(tmpdir))
- _yaml.dump({'(@)': ['a.yml', 'b.yml'],
- 'test': {'(=)': ['Overwritten']}},
- str(tmpdir.join('main.yml')))
+ _yaml.roundtrip_dump({'(@)': ['a.yml', 'b.yml'], 'test': {'(=)': ['Overwritten']}},
+ str(tmpdir.join('main.yml')))
main = _yaml.load(str(tmpdir.join('main.yml')))
# a.yml
- _yaml.dump({'test': ['some useless', 'list', 'to be overwritten'],
- 'foo': 'should not be present'},
- str(tmpdir.join('a.yml')))
+ _yaml.roundtrip_dump({'test': ['some useless', 'list', 'to be overwritten'],
+ 'foo': 'should not be present'},
+ str(tmpdir.join('a.yml')))
# b.yaml isn't going to have a 'test' node to overwrite
- _yaml.dump({'foo': 'should be present'},
- str(tmpdir.join('b.yml')))
+ _yaml.roundtrip_dump({'foo': 'should be present'},
+ str(tmpdir.join('b.yml')))
includes.process(main)
diff --git a/tests/format/junctions.py b/tests/format/junctions.py
index 8842bc617..b810c55a3 100644
--- a/tests/format/junctions.py
+++ b/tests/format/junctions.py
@@ -331,7 +331,7 @@ def test_git_show(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, os.path.join(project, 'base.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'base.bst'))
# Check that bst show succeeds with implicit subproject fetching and the
# pipeline includes the subproject element
@@ -356,7 +356,7 @@ def test_git_build(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, os.path.join(project, 'base.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'base.bst'))
# Build (with implicit fetch of subproject), checkout
result = cli.run(project=project, args=['build', 'target.bst'])
@@ -389,7 +389,7 @@ def test_git_missing_project_conf(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, str(project / 'base.bst'))
+ _yaml.roundtrip_dump(element, str(project / 'base.bst'))
result = cli.run(project=project, args=['build', 'app.bst'])
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION)
@@ -423,7 +423,7 @@ def test_build_git_cross_junction_names(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, os.path.join(project, 'base.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'base.bst'))
print(element)
print(cli.get_pipeline(project, ['base.bst']))
diff --git a/tests/format/project.py b/tests/format/project.py
index 697fe7e3d..2e0a729dc 100644
--- a/tests/format/project.py
+++ b/tests/format/project.py
@@ -200,7 +200,7 @@ def test_plugin_no_load_ref(cli, datafiles, ref_storage):
}
]
}
- _yaml.dump(config, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(config, os.path.join(project, 'project.conf'))
result = cli.run(project=project, silent=True, args=['show', 'noloadref.bst'])
diff --git a/tests/format/variables.py b/tests/format/variables.py
index ed5407b83..93814279a 100644
--- a/tests/format/variables.py
+++ b/tests/format/variables.py
@@ -110,7 +110,7 @@ def test_use_of_protected_var_project_conf(cli, datafiles, protected_var):
protected_var: 'some-value'
}
}
- _yaml.dump(conf, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(conf, os.path.join(project, 'project.conf'))
element = {
'kind': 'import',
@@ -121,7 +121,7 @@ def test_use_of_protected_var_project_conf(cli, datafiles, protected_var):
}
],
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_main_error(ErrorDomain.LOAD,
@@ -142,7 +142,7 @@ def test_use_of_protected_var_element_overrides(cli, datafiles, protected_var):
}
}
}
- _yaml.dump(conf, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(conf, os.path.join(project, 'project.conf'))
element = {
'kind': 'manual',
@@ -153,7 +153,7 @@ def test_use_of_protected_var_element_overrides(cli, datafiles, protected_var):
}
],
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_main_error(ErrorDomain.LOAD,
@@ -176,7 +176,7 @@ def test_use_of_protected_var_in_element(cli, datafiles, protected_var):
protected_var: 'some-value'
}
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_main_error(ErrorDomain.LOAD,
diff --git a/tests/frontend/__init__.py b/tests/frontend/__init__.py
index 8cf7625a9..f1c8c41b8 100644
--- a/tests/frontend/__init__.py
+++ b/tests/frontend/__init__.py
@@ -7,4 +7,4 @@ from buildstream import _yaml
def configure_project(path, config):
config['name'] = 'test'
config['element-path'] = 'elements'
- _yaml.dump(config, os.path.join(path, 'project.conf'))
+ _yaml.roundtrip_dump(config, os.path.join(path, 'project.conf'))
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py
index f9cd1cba4..07ebe7e6a 100644
--- a/tests/frontend/buildcheckout.py
+++ b/tests/frontend/buildcheckout.py
@@ -133,7 +133,7 @@ def test_build_invalid_filename_chars(datafiles, cli):
element = {
'kind': 'stack',
}
- _yaml.dump(element, os.path.join(project, 'elements', element_name))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'elements', element_name))
result = cli.run(project=project, args=strict_args(['build', element_name], 'non-strict'))
result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name")
@@ -151,7 +151,7 @@ def test_build_invalid_filename_chars_dep(datafiles, cli):
element = {
'kind': 'stack',
}
- _yaml.dump(element, os.path.join(project, 'elements', element_name))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'elements', element_name))
result = cli.run(project=project, args=strict_args(['build', 'invalid-chars-in-dep.bst'], 'non-strict'))
result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name")
@@ -452,7 +452,7 @@ def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to track it, this will bail with the appropriate error
# informing the user to track the junction first
@@ -492,7 +492,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Dump a project.refs if we're using project.refs storage
#
@@ -508,7 +508,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage):
}
}
}
- _yaml.dump(project_refs, os.path.join(project, 'junction.refs'))
+ _yaml.roundtrip_dump(project_refs, os.path.join(project, 'junction.refs'))
# Now try to build it, this should automatically result in fetching
# the junction itself at load time.
@@ -541,7 +541,7 @@ def test_build_checkout_junction(cli, tmpdir, datafiles):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to build it, this should automatically result in fetching
# the junction itself at load time.
@@ -588,7 +588,7 @@ def test_build_checkout_junction_default_targets(cli, tmpdir, datafiles):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to build it, this should automatically result in fetching
# the junction itself at load time.
@@ -635,7 +635,7 @@ def test_build_checkout_workspaced_junction(cli, tmpdir, datafiles):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now open a workspace on the junction
#
@@ -712,7 +712,7 @@ def test_build_junction_short_notation(cli, tmpdir, datafiles):
'kind': 'stack',
'depends': ['junction.bst:import-etc.bst']
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to build it, this should automatically result in fetching
# the junction itself at load time.
@@ -753,7 +753,7 @@ def test_build_junction_short_notation_filename(cli, tmpdir, datafiles):
'kind': 'stack',
'depends': [{'filename': 'junction.bst:import-etc.bst'}]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to build it, this should automatically result in fetching
# the junction itself at load time.
@@ -796,7 +796,7 @@ def test_build_junction_short_notation_with_junction(cli, tmpdir, datafiles):
'junction': 'junction.bst',
}]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to build it, this should fail as filenames should not contain
# `:` when junction is explicity specified
@@ -820,7 +820,7 @@ def test_build_junction_transitive_short_notation_with_junction(cli, tmpdir, dat
'kind': 'stack',
'depends': ['junction.bst:import-etc.bst:foo.bst']
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to build it, this should fail as recursive lookups for
# cross-junction elements is not allowed.
diff --git a/tests/frontend/buildtrack.py b/tests/frontend/buildtrack.py
index d42b6d1ba..12b90b0d7 100644
--- a/tests/frontend/buildtrack.py
+++ b/tests/frontend/buildtrack.py
@@ -31,7 +31,7 @@ def create_element(repo, name, path, dependencies, ref=None):
],
'depends': dependencies
}
- _yaml.dump(element, os.path.join(path, name))
+ _yaml.roundtrip_dump(element, os.path.join(path, name))
@pytest.mark.datafiles(os.path.join(DATA_DIR))
@@ -120,7 +120,7 @@ def test_build_track(cli, datafiles, tmpdir, ref_storage, strict,
'test': initial_project_refs
}
}
- _yaml.dump(project_refs, os.path.join(project, 'project.refs'))
+ _yaml.roundtrip_dump(project_refs, os.path.join(project, 'project.refs'))
args = ['build']
args += itertools.chain.from_iterable(zip(itertools.repeat('--track'), track_targets))
@@ -219,7 +219,7 @@ def test_build_track_all(cli, tmpdir, datafiles, strict, ref_storage):
}
]
}
- _yaml.dump(element, os.path.join(element_path, 'composed.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, 'composed.bst'))
# Track the junction itself first.
result = cli.run(project=project, args=['source', 'track', 'junction.bst'])
diff --git a/tests/frontend/configurable_warnings.py b/tests/frontend/configurable_warnings.py
index c63a0b673..7936b2f89 100644
--- a/tests/frontend/configurable_warnings.py
+++ b/tests/frontend/configurable_warnings.py
@@ -40,7 +40,7 @@ def build_project(datafiles, fatal_warnings):
project = get_project(fatal_warnings)
- _yaml.dump(project, os.path.join(project_path, "project.conf"))
+ _yaml.roundtrip_dump(project, os.path.join(project_path, "project.conf"))
return project_path
diff --git a/tests/frontend/cross_junction_workspace.py b/tests/frontend/cross_junction_workspace.py
index 38aafa558..ca21e7548 100644
--- a/tests/frontend/cross_junction_workspace.py
+++ b/tests/frontend/cross_junction_workspace.py
@@ -13,8 +13,8 @@ def prepare_junction_project(cli, tmpdir):
os.makedirs(str(main_project))
os.makedirs(str(sub_project))
- _yaml.dump({'name': 'main'}, str(main_project.join("project.conf")))
- _yaml.dump({'name': 'sub'}, str(sub_project.join("project.conf")))
+ _yaml.roundtrip_dump({'name': 'main'}, str(main_project.join("project.conf")))
+ _yaml.roundtrip_dump({'name': 'sub'}, str(sub_project.join("project.conf")))
import_dir = tmpdir.join("import")
os.makedirs(str(import_dir))
@@ -26,18 +26,18 @@ def prepare_junction_project(cli, tmpdir):
import_repo = create_repo("git", str(import_repo_dir))
import_ref = import_repo.create(str(import_dir))
- _yaml.dump({'kind': 'import',
- 'sources': [import_repo.source_config(ref=import_ref)]},
- str(sub_project.join("data.bst")))
+ _yaml.roundtrip_dump({'kind': 'import',
+ 'sources': [import_repo.source_config(ref=import_ref)]},
+ str(sub_project.join("data.bst")))
sub_repo_dir = tmpdir.join("sub_repo")
os.makedirs(str(sub_repo_dir))
sub_repo = create_repo("git", str(sub_repo_dir))
sub_ref = sub_repo.create(str(sub_project))
- _yaml.dump({'kind': 'junction',
- 'sources': [sub_repo.source_config(ref=sub_ref)]},
- str(main_project.join("sub.bst")))
+ _yaml.roundtrip_dump({'kind': 'junction',
+ 'sources': [sub_repo.source_config(ref=sub_ref)]},
+ str(main_project.join("sub.bst")))
args = ['source', 'fetch', 'sub.bst']
result = cli.run(project=str(main_project), args=args)
diff --git a/tests/frontend/fetch.py b/tests/frontend/fetch.py
index d7e0ecafb..ba79dcfd1 100644
--- a/tests/frontend/fetch.py
+++ b/tests/frontend/fetch.py
@@ -37,9 +37,8 @@ def test_fetch_default_targets(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
# Assert that a fetch is needed
assert cli.get_element_state(project, element_name) == 'fetch needed'
@@ -113,7 +112,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, strict, ref_storage):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Dump a project.refs if we're using project.refs storage
#
@@ -129,7 +128,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, strict, ref_storage):
}
}
}
- _yaml.dump(project_refs, os.path.join(project, 'junction.refs'))
+ _yaml.roundtrip_dump(project_refs, os.path.join(project, 'junction.refs'))
# Now try to fetch it, this should automatically result in fetching
# the junction itself.
@@ -163,7 +162,7 @@ def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to fetch it, this will bail with the appropriate error
# informing the user to track the junction first
diff --git a/tests/frontend/logging.py b/tests/frontend/logging.py
index a8f894976..6a17bf771 100644
--- a/tests/frontend/logging.py
+++ b/tests/frontend/logging.py
@@ -39,9 +39,8 @@ def test_default_logging(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
# Now try to fetch it
result = cli.run(project=project, args=['source', 'fetch', element_name])
@@ -76,9 +75,8 @@ def test_custom_logging(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
# Now try to fetch it
result = cli.run(project=project, args=['source', 'fetch', element_name])
@@ -104,7 +102,7 @@ def test_failed_build_listing(cli, datafiles):
]
}
}
- _yaml.dump(element, os.path.join(project, element_path))
+ _yaml.roundtrip_dump(element, os.path.join(project, element_path))
element_names.append(element_name)
result = cli.run(project=project, args=['--on-error=continue', 'build', *element_names])
result.assert_main_error(ErrorDomain.STREAM, None)
diff --git a/tests/frontend/mirror.py b/tests/frontend/mirror.py
index 09beb38b8..855155785 100644
--- a/tests/frontend/mirror.py
+++ b/tests/frontend/mirror.py
@@ -116,7 +116,7 @@ def test_mirror_fetch_ref_storage(cli, tmpdir, datafiles, ref_storage, mirror):
full_mirror = mirror_repo.source_config()['url']
mirror_map, _ = os.path.split(full_mirror)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
if ref_storage == 'project.refs':
# Manually set project.refs to avoid caching the repo prematurely
@@ -128,7 +128,7 @@ def test_mirror_fetch_ref_storage(cli, tmpdir, datafiles, ref_storage, mirror):
}
}}
project_refs_path = os.path.join(project_dir, 'project.refs')
- _yaml.dump(project_refs, project_refs_path)
+ _yaml.roundtrip_dump(project_refs, project_refs_path)
project = {
'name': 'test',
@@ -151,7 +151,7 @@ def test_mirror_fetch_ref_storage(cli, tmpdir, datafiles, ref_storage, mirror):
project['mirrors'] = mirror_data
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
result = cli.run(project=project_dir, args=['source', 'fetch', element_name])
result.assert_success()
@@ -167,11 +167,11 @@ def test_mirror_fetch_multi(cli, tmpdir):
element_name = "test.bst"
element_path = os.path.join(element_dir, element_name)
element = generate_element(output_file)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project_file = os.path.join(project_dir, 'project.conf')
project = generate_project()
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
result = cli.run(project=project_dir, args=['source', 'fetch', element_name])
result.assert_success()
@@ -191,11 +191,11 @@ def test_mirror_fetch_default_cmdline(cli, tmpdir):
element_name = "test.bst"
element_path = os.path.join(element_dir, element_name)
element = generate_element(output_file)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project_file = os.path.join(project_dir, 'project.conf')
project = generate_project()
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
result = cli.run(project=project_dir, args=['--default-mirror', 'arrakis', 'source', 'fetch', element_name])
result.assert_success()
@@ -222,11 +222,11 @@ def test_mirror_fetch_default_userconfig(cli, tmpdir):
element_name = "test.bst"
element_path = os.path.join(element_dir, element_name)
element = generate_element(output_file)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project_file = os.path.join(project_dir, 'project.conf')
project = generate_project()
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
userconfig = {
'projects': {
@@ -262,11 +262,11 @@ def test_mirror_fetch_default_cmdline_overrides_config(cli, tmpdir):
element_name = "test.bst"
element_path = os.path.join(element_dir, element_name)
element = generate_element(output_file)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project_file = os.path.join(project_dir, 'project.conf')
project = generate_project()
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
userconfig = {
'projects': {
@@ -346,7 +346,7 @@ def test_mirror_git_submodule_fetch(cli, tmpdir, datafiles):
aliased_repo = alias + ':' + repo_name
element['sources'][0]['submodules']['defined']['url'] = aliased_repo
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
full_mirror = main_mirror.source_config()['url']
mirror_map, _ = os.path.split(full_mirror)
@@ -366,7 +366,7 @@ def test_mirror_git_submodule_fetch(cli, tmpdir, datafiles):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
result = cli.run(project=project_dir, args=['source', 'fetch', element_name])
result.assert_success()
@@ -433,7 +433,7 @@ def test_mirror_fallback_git_only_submodules(cli, tmpdir, datafiles):
element_name = 'test.bst'
element_path = os.path.join(element_dir, element_name)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project = {
'name': 'test',
@@ -451,7 +451,7 @@ def test_mirror_fallback_git_only_submodules(cli, tmpdir, datafiles):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
# Now make the upstream unavailable.
os.rename(upstream_bin_repo.repo, '{}.bak'.format(upstream_bin_repo.repo))
@@ -529,7 +529,7 @@ def test_mirror_fallback_git_with_submodules(cli, tmpdir, datafiles):
element_name = 'test.bst'
element_path = os.path.join(element_dir, element_name)
os.makedirs(element_dir)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
project = {
'name': 'test',
@@ -547,7 +547,7 @@ def test_mirror_fallback_git_with_submodules(cli, tmpdir, datafiles):
]
}
project_file = os.path.join(project_dir, 'project.conf')
- _yaml.dump(project, project_file)
+ _yaml.roundtrip_dump(project, project_file)
# Now make the upstream unavailable.
os.rename(upstream_main_repo.repo, '{}.bak'.format(upstream_main_repo.repo))
diff --git a/tests/frontend/order.py b/tests/frontend/order.py
index 7f354c88e..c62377419 100644
--- a/tests/frontend/order.py
+++ b/tests/frontend/order.py
@@ -37,7 +37,7 @@ def create_element(project, name, dependencies):
],
'depends': dependencies
}
- _yaml.dump(element, os.path.join(element_path, name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, name))
return repo
diff --git a/tests/frontend/overlaps.py b/tests/frontend/overlaps.py
index 6f6ab26a3..eb2cd4a86 100644
--- a/tests/frontend/overlaps.py
+++ b/tests/frontend/overlaps.py
@@ -25,7 +25,7 @@ def gen_project(project_dir, fail_on_overlap, use_fatal_warnings=True, project_n
else:
template["fail-on-overlap"] = fail_on_overlap
projectfile = os.path.join(project_dir, "project.conf")
- _yaml.dump(template, projectfile)
+ _yaml.roundtrip_dump(template, projectfile)
@pytest.mark.datafiles(DATA_DIR)
diff --git a/tests/frontend/remote-caches.py b/tests/frontend/remote-caches.py
index 8a5ef9c7b..6ee57df23 100644
--- a/tests/frontend/remote-caches.py
+++ b/tests/frontend/remote-caches.py
@@ -57,7 +57,7 @@ def test_source_artifact_caches(cli, tmpdir, datafiles):
},
'cachedir': cachedir
}
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
cli.configure(user_config)
create_element_size('repo.bst', project_dir, element_path, [], 10000)
diff --git a/tests/frontend/show.py b/tests/frontend/show.py
index 4192ba1e5..2bb04f465 100644
--- a/tests/frontend/show.py
+++ b/tests/frontend/show.py
@@ -252,7 +252,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage, element_name, w
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Dump a project.refs if we're using project.refs storage
#
@@ -268,7 +268,7 @@ def test_unfetched_junction(cli, tmpdir, datafiles, ref_storage, element_name, w
}
}
}
- _yaml.dump(project_refs, os.path.join(project, 'junction.refs'))
+ _yaml.roundtrip_dump(project_refs, os.path.join(project, 'junction.refs'))
# Open a workspace if we're testing workspaced behavior
if workspaced:
@@ -310,7 +310,7 @@ def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage, workspaced):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Open a workspace if we're testing workspaced behavior
if workspaced:
@@ -366,7 +366,7 @@ def test_fetched_junction(cli, tmpdir, datafiles, element_name, workspaced):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
result = cli.run(project=project, silent=True, args=[
'source', 'fetch', 'junction.bst'])
@@ -421,7 +421,7 @@ def test_exceed_max_recursion_depth(cli, tmpdir, dependency_depth):
}
if i == 0:
del element['depends']
- _yaml.dump(element, os.path.join(element_path, "element{}.bst".format(str(i))))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, "element{}.bst".format(str(i))))
source = os.path.join(sourcefiles_path, "source{}".format(str(i)))
open(source, 'x').close()
diff --git a/tests/frontend/source_checkout.py b/tests/frontend/source_checkout.py
index 38041c45d..1831ee863 100644
--- a/tests/frontend/source_checkout.py
+++ b/tests/frontend/source_checkout.py
@@ -154,7 +154,7 @@ def test_source_checkout_fetch(datafiles, cli):
element = generate_remote_import_element(
os.path.join(project, 'files', 'dev-files', 'usr', 'include', 'pony.h'),
'pony.h')
- _yaml.dump(element, target_path)
+ _yaml.roundtrip_dump(element, target_path)
# Testing implicit fetching requires that we do not have the sources
# cached already
diff --git a/tests/frontend/track.py b/tests/frontend/track.py
index 1163cc687..b8ab0d4eb 100644
--- a/tests/frontend/track.py
+++ b/tests/frontend/track.py
@@ -27,7 +27,7 @@ def generate_element(repo, element_path, dep_name=None):
if dep_name:
element['depends'] = [dep_name]
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
@pytest.mark.datafiles(DATA_DIR)
@@ -156,7 +156,7 @@ def test_track_cross_junction(cli, tmpdir, datafiles, cross_junction, ref_storag
'name': 'test',
'ref-storage': ref_storage
}
- _yaml.dump(project_conf, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_conf, os.path.join(project, 'project.conf'))
#
# FIXME: This can be simplified when we have support
@@ -267,7 +267,7 @@ def test_inconsistent_junction(cli, tmpdir, datafiles, ref_storage):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Now try to track it, this will bail with the appropriate error
# informing the user to track the junction first
@@ -307,7 +307,7 @@ def test_junction_element(cli, tmpdir, datafiles, ref_storage):
}
]
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# First demonstrate that showing the pipeline yields an error
result = cli.run(project=project, args=['show', 'junction-dep.bst'])
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 6b71fbc08..4951a74a4 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -92,9 +92,8 @@ class WorkspaceCreator():
}
if element_attrs:
element = {**element, **element_attrs}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
return element_name, element_path, workspace_dir
def create_workspace_elements(self, kinds, track, suffixs=None, workspace_dir_usr=None,
@@ -683,9 +682,8 @@ def test_buildable_no_ref(cli, tmpdir, datafiles):
repo.source_config()
]
}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
# Assert that this target is not buildable when no workspace is associated.
assert cli.get_element_state(project, element_name) == 'no reference'
@@ -804,7 +802,7 @@ def test_list_unsupported_workspace(cli, datafiles, workspace_cfg):
os.makedirs(os.path.join(project, '.bst'))
workspace_config_path = os.path.join(project, '.bst', 'workspaces.yml')
- _yaml.dump(workspace_cfg, workspace_config_path)
+ _yaml.roundtrip_dump(workspace_cfg, workspace_config_path)
result = cli.run(project=project, args=['workspace', 'list'])
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
@@ -909,14 +907,14 @@ def test_list_unsupported_workspace(cli, datafiles, workspace_cfg):
def test_list_supported_workspace(cli, tmpdir, datafiles, workspace_cfg, expected):
def parse_dict_as_yaml(node):
tempfile = os.path.join(str(tmpdir), 'yaml_dump')
- _yaml.dump(node, tempfile)
+ _yaml.roundtrip_dump(node, tempfile)
return _yaml.node_sanitize(_yaml.load(tempfile))
project = str(datafiles)
os.makedirs(os.path.join(project, '.bst'))
workspace_config_path = os.path.join(project, '.bst', 'workspaces.yml')
- _yaml.dump(workspace_cfg, workspace_config_path)
+ _yaml.roundtrip_dump(workspace_cfg, workspace_config_path)
# Check that we can still read workspace config that is in old format
result = cli.run(project=project, args=['workspace', 'list'])
@@ -947,9 +945,8 @@ def test_list_supported_workspace(cli, tmpdir, datafiles, workspace_cfg, expecte
repo.source_config(ref=ref)
]
}
- _yaml.dump(element,
- os.path.join(element_path,
- element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, element_name))
# Make a change to the workspaces file
result = cli.run(project=project, args=['workspace', 'open', '--directory', workspace, element_name])
@@ -994,9 +991,8 @@ def test_cache_key_workspace_in_dependencies(cli, tmpdir, datafiles, strict):
}
]
}
- _yaml.dump(element,
- os.path.join(element_path,
- back_dep_element_name))
+ _yaml.roundtrip_dump(element,
+ os.path.join(element_path, back_dep_element_name))
# Modify workspace
shutil.rmtree(os.path.join(workspace, 'usr', 'bin'))
@@ -1133,7 +1129,7 @@ def test_external_track(cli, datafiles, tmpdir_factory, guess_element):
# element has been tracked
element_contents = _yaml.load(element_file)
del element_contents.get_sequence('sources').mapping_at(0)['ref']
- _yaml.dump(element_contents, element_file)
+ _yaml.roundtrip_dump(element_contents, element_file)
result = cli.run(project=project, args=['-C', workspace, 'source', 'track', *arg_elm])
result.assert_success()
@@ -1247,7 +1243,7 @@ def test_multisource_workspace(cli, datafiles, tmpdir):
}]
}
element_path = os.path.join(project, 'elements', element_name)
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
workspace_dir = os.path.join(str(tmpdir), 'multisource')
res = cli.run(project=project,
diff --git a/tests/integration/cachedfail.py b/tests/integration/cachedfail.py
index a2273a06d..64fccadad 100644
--- a/tests/integration/cachedfail.py
+++ b/tests/integration/cachedfail.py
@@ -45,7 +45,7 @@ def test_build_checkout_cached_fail(cli, datafiles):
],
},
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Try to build it, this should result in a failure that contains the content
result = cli.run(project=project, args=['build', 'element.bst'])
@@ -87,7 +87,7 @@ def test_build_depend_on_cached_fail(cli, datafiles):
],
},
}
- _yaml.dump(dep, dep_path)
+ _yaml.roundtrip_dump(dep, dep_path)
target = {
'kind': 'script',
'depends': [
@@ -106,7 +106,7 @@ def test_build_depend_on_cached_fail(cli, datafiles):
],
},
}
- _yaml.dump(target, target_path)
+ _yaml.roundtrip_dump(target, target_path)
# Try to build it, this should result in caching a failure to build dep
result = cli.run(project=project, args=['build', 'dep.bst'])
@@ -150,7 +150,7 @@ def test_push_cached_fail(cli, tmpdir, datafiles, on_error):
],
},
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
with create_artifact_share(os.path.join(str(tmpdir), 'remote')) as share:
cli.configure({
@@ -188,7 +188,7 @@ def test_host_tools_errors_are_not_cached(cli, datafiles):
],
},
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Build without access to host tools, this will fail
result1 = cli.run(project=project, args=['build', 'element.bst'], env={'PATH': ''})
diff --git a/tests/integration/compose.py b/tests/integration/compose.py
index 2b37942fa..3562ed94b 100644
--- a/tests/integration/compose.py
+++ b/tests/integration/compose.py
@@ -36,7 +36,7 @@ def create_compose_element(name, path, config=None):
'config': config
}
os.makedirs(os.path.dirname(os.path.join(path, name)), exist_ok=True)
- _yaml.dump(element, os.path.join(path, name))
+ _yaml.roundtrip_dump(element, os.path.join(path, name))
@pytest.mark.datafiles(DATA_DIR)
diff --git a/tests/integration/import.py b/tests/integration/import.py
index 5371ec61a..bac92cadf 100644
--- a/tests/integration/import.py
+++ b/tests/integration/import.py
@@ -32,7 +32,7 @@ def create_import_element(name, path, source, target, source_path):
}
}
os.makedirs(os.path.dirname(os.path.join(path, name)), exist_ok=True)
- _yaml.dump(element, os.path.join(path, name))
+ _yaml.roundtrip_dump(element, os.path.join(path, name))
@pytest.mark.datafiles(DATA_DIR)
diff --git a/tests/integration/manual.py b/tests/integration/manual.py
index b3124a852..2ac7f74d0 100644
--- a/tests/integration/manual.py
+++ b/tests/integration/manual.py
@@ -31,7 +31,7 @@ def create_manual_element(name, path, config, variables, environment):
'environment': environment
}
os.makedirs(os.path.dirname(os.path.join(path, name)), exist_ok=True)
- _yaml.dump(element, os.path.join(path, name))
+ _yaml.roundtrip_dump(element, os.path.join(path, name))
@pytest.mark.datafiles(DATA_DIR)
diff --git a/tests/integration/messages.py b/tests/integration/messages.py
index edfb435ae..42725fc5b 100644
--- a/tests/integration/messages.py
+++ b/tests/integration/messages.py
@@ -59,7 +59,7 @@ def test_disable_message_lines(cli, datafiles):
}
os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
# First we check that we get the "Silly message"
result = cli.run(project=project, args=["build", element_name])
@@ -94,7 +94,7 @@ def test_disable_error_lines(cli, datafiles):
}
os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
# First we check that we get the syntax error
result = cli.run(project=project, args=["--error-lines", "0",
diff --git a/tests/integration/pip_element.py b/tests/integration/pip_element.py
index 91dcaa39e..da0badcb3 100644
--- a/tests/integration/pip_element.py
+++ b/tests/integration/pip_element.py
@@ -47,7 +47,7 @@ def test_pip_build(cli, datafiles):
}]
}
os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
result = cli.run(project=project, args=['build', element_name])
assert result.exit_code == 0
@@ -119,7 +119,7 @@ def test_pip_element_should_install_pip_deps(cli, datafiles, setup_pypi_repo):
}
]
}
- _yaml.dump(element, os.path.join(elements_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(elements_path, element_name))
result = cli.run(project=project, args=['source', 'track', element_name])
assert result.exit_code == 0
diff --git a/tests/integration/pip_source.py b/tests/integration/pip_source.py
index 632b5ae24..c221910a6 100644
--- a/tests/integration/pip_source.py
+++ b/tests/integration/pip_source.py
@@ -58,7 +58,7 @@ def test_pip_source_import_packages(cli, datafiles, setup_pypi_repo):
]
}
os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
result = cli.run(project=project, args=['source', 'track', element_name])
assert result.exit_code == 0
@@ -116,7 +116,7 @@ def test_pip_source_import_requirements_files(cli, datafiles, setup_pypi_repo):
]
}
os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
result = cli.run(project=project, args=['source', 'track', element_name])
assert result.exit_code == 0
@@ -182,7 +182,7 @@ def test_pip_source_build(cli, datafiles, setup_pypi_repo):
}
}
os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
result = cli.run(project=project, args=['source', 'track', element_name])
assert result.exit_code == 0
diff --git a/tests/integration/script.py b/tests/integration/script.py
index 1025709f4..fc57e8744 100644
--- a/tests/integration/script.py
+++ b/tests/integration/script.py
@@ -35,7 +35,7 @@ def create_script_element(name, path, config=None, variables=None):
'variables': variables
}
os.makedirs(os.path.dirname(os.path.join(path, name)), exist_ok=True)
- _yaml.dump(element, os.path.join(path, name))
+ _yaml.roundtrip_dump(element, os.path.join(path, name))
@pytest.mark.datafiles(DATA_DIR)
diff --git a/tests/integration/shell.py b/tests/integration/shell.py
index f7de3e462..a1f38d879 100644
--- a/tests/integration/shell.py
+++ b/tests/integration/shell.py
@@ -163,7 +163,7 @@ def test_no_shell(cli, datafiles):
}
}
os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
result = execute_shell(cli, project, ['/bin/echo', 'Pegasissies!'], element=element_name)
assert result.exit_code == 0
diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py
index 4590d4102..70c4b79de 100644
--- a/tests/integration/source-determinism.py
+++ b/tests/integration/source-determinism.py
@@ -60,7 +60,7 @@ def test_deterministic_source_local(cli, tmpdir, datafiles):
]
}
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
def get_value_for_mask(mask):
checkoutdir = os.path.join(str(tmpdir), 'checkout-{}'.format(mask))
diff --git a/tests/integration/workspace.py b/tests/integration/workspace.py
index fff9518a3..78379912c 100644
--- a/tests/integration/workspace.py
+++ b/tests/integration/workspace.py
@@ -74,7 +74,7 @@ def test_workspace_updated_dependency(cli, datafiles):
}
}
os.makedirs(os.path.dirname(os.path.join(element_path, dep_name)), exist_ok=True)
- _yaml.dump(dependency, os.path.join(element_path, dep_name))
+ _yaml.roundtrip_dump(dependency, os.path.join(element_path, dep_name))
# First open the workspace
res = cli.run(project=project, args=['workspace', 'open', '--directory', workspace, element_name])
@@ -90,7 +90,7 @@ def test_workspace_updated_dependency(cli, datafiles):
'mkdir -p %{install-root}/etc/test/',
'echo "Hello china!" > %{install-root}/etc/test/hello.txt'
]
- _yaml.dump(dependency, os.path.join(element_path, dep_name))
+ _yaml.roundtrip_dump(dependency, os.path.join(element_path, dep_name))
# `Make` would look at timestamps and normally not realize that
# our dependency's header files changed. BuildStream must
@@ -129,7 +129,7 @@ def test_workspace_update_dependency_failed(cli, datafiles):
}
}
os.makedirs(os.path.dirname(os.path.join(element_path, dep_name)), exist_ok=True)
- _yaml.dump(dependency, os.path.join(element_path, dep_name))
+ _yaml.roundtrip_dump(dependency, os.path.join(element_path, dep_name))
# First open the workspace
res = cli.run(project=project, args=['workspace', 'open', '--directory', workspace, element_name])
@@ -146,7 +146,7 @@ def test_workspace_update_dependency_failed(cli, datafiles):
'echo "Hello china!" > %{install-root}/etc/test/hello.txt',
'echo "Hello brazil!" > %{install-root}/etc/test/brazil.txt'
]
- _yaml.dump(dependency, os.path.join(element_path, dep_name))
+ _yaml.roundtrip_dump(dependency, os.path.join(element_path, dep_name))
# And our build fails!
with open(os.path.join(workspace, 'Makefile'), 'a') as f:
@@ -161,7 +161,7 @@ def test_workspace_update_dependency_failed(cli, datafiles):
'echo "Hello world!" > %{install-root}/etc/test/hello.txt',
'echo "Hello spain!" > %{install-root}/etc/test/brazil.txt'
]
- _yaml.dump(dependency, os.path.join(element_path, dep_name))
+ _yaml.roundtrip_dump(dependency, os.path.join(element_path, dep_name))
# And fix the source
with open(os.path.join(workspace, 'Makefile'), 'r') as f:
@@ -204,7 +204,7 @@ def test_updated_dependency_nested(cli, datafiles):
}
}
os.makedirs(os.path.dirname(os.path.join(element_path, dep_name)), exist_ok=True)
- _yaml.dump(dependency, os.path.join(element_path, dep_name))
+ _yaml.roundtrip_dump(dependency, os.path.join(element_path, dep_name))
# First open the workspace
res = cli.run(project=project, args=['workspace', 'open', '--directory', workspace, element_name])
@@ -221,7 +221,7 @@ def test_updated_dependency_nested(cli, datafiles):
'echo "Hello world!" > %{install-root}/etc/test/hello.txt',
'echo "Hello test!" > %{install-root}/etc/test/tests/tests.txt'
]
- _yaml.dump(dependency, os.path.join(element_path, dep_name))
+ _yaml.roundtrip_dump(dependency, os.path.join(element_path, dep_name))
res = cli.run(project=project, args=['build', element_name])
assert res.exit_code == 0
@@ -257,7 +257,7 @@ def test_incremental_configure_commands_run_only_once(cli, datafiles):
]
}
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
# We open a workspace on the above element
res = cli.run(project=project, args=['workspace', 'open', '--directory', workspace, element_name])
diff --git a/tests/sandboxes/missing_dependencies.py b/tests/sandboxes/missing_dependencies.py
index ee346010e..42be4c9c2 100644
--- a/tests/sandboxes/missing_dependencies.py
+++ b/tests/sandboxes/missing_dependencies.py
@@ -39,7 +39,7 @@ def test_missing_brwap_has_nice_error_message(cli, datafiles):
],
},
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Build without access to host tools, this should fail with a nice error
result = cli.run(
@@ -79,7 +79,7 @@ def test_old_brwap_has_nice_error_message(cli, datafiles, tmp_path):
],
},
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Build without access to host tools, this should fail with a nice error
result = cli.run(
diff --git a/tests/sandboxes/remote-exec-config.py b/tests/sandboxes/remote-exec-config.py
index 90418d6fc..a6aeeb7ab 100644
--- a/tests/sandboxes/remote-exec-config.py
+++ b/tests/sandboxes/remote-exec-config.py
@@ -38,7 +38,7 @@ def test_old_and_new_configs(cli, datafiles):
}
}
project_conf_file = os.path.join(project, 'project.conf')
- _yaml.dump(project_conf, project_conf_file)
+ _yaml.roundtrip_dump(project_conf, project_conf_file)
# Use `pull` here to ensure we try to initialize the remotes, triggering the error
#
@@ -72,7 +72,7 @@ def test_missing_certs(cli, datafiles, config_key, config_value):
}
}
project_conf_file = os.path.join(project, 'project.conf')
- _yaml.dump(project_conf, project_conf_file)
+ _yaml.roundtrip_dump(project_conf, project_conf_file)
# Use `pull` here to ensure we try to initialize the remotes, triggering the error
#
@@ -93,7 +93,7 @@ def test_empty_config(cli, datafiles):
}
}
project_conf_file = os.path.join(project, 'project.conf')
- _yaml.dump(project_conf, project_conf_file)
+ _yaml.roundtrip_dump(project_conf, project_conf_file)
# Use `pull` here to ensure we try to initialize the remotes, triggering the error
#
diff --git a/tests/sourcecache/cache.py b/tests/sourcecache/cache.py
index 20faaa64e..9672fabd4 100644
--- a/tests/sourcecache/cache.py
+++ b/tests/sourcecache/cache.py
@@ -96,7 +96,7 @@ def test_source_cache_key(cli, datafiles):
}
]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
res = cli.run(project=project_dir, args=["source", "track", element_name])
res.assert_success()
diff --git a/tests/sourcecache/config.py b/tests/sourcecache/config.py
index 7c33adbe0..2ab11e9f9 100644
--- a/tests/sourcecache/config.py
+++ b/tests/sourcecache/config.py
@@ -53,7 +53,7 @@ def test_missing_certs(cli, datafiles, config_key, config_value):
}
}
project_conf_file = os.path.join(project, 'project.conf')
- _yaml.dump(project_conf, project_conf_file)
+ _yaml.roundtrip_dump(project_conf, project_conf_file)
# Use `pull` here to ensure we try to initialize the remotes, triggering the error
#
diff --git a/tests/sourcecache/fetch.py b/tests/sourcecache/fetch.py
index cd8a3e989..3f1bce777 100644
--- a/tests/sourcecache/fetch.py
+++ b/tests/sourcecache/fetch.py
@@ -56,7 +56,7 @@ def test_source_fetch(cli, tmpdir, datafiles):
},
'cachedir': cache_dir,
}
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
cli.configure(user_config)
repo = create_repo('git', str(tmpdir))
@@ -67,7 +67,7 @@ def test_source_fetch(cli, tmpdir, datafiles):
'kind': 'import',
'sources': [repo.source_config(ref=ref)]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
context = Context()
context.load(config=user_config_file)
@@ -131,7 +131,7 @@ def test_fetch_fallback(cli, tmpdir, datafiles):
},
'cachedir': cache_dir,
}
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
cli.configure(user_config)
repo = create_repo('git', str(tmpdir))
@@ -142,7 +142,7 @@ def test_fetch_fallback(cli, tmpdir, datafiles):
'kind': 'import',
'sources': [repo.source_config(ref=ref)]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
context = Context()
context.load(config=user_config_file)
@@ -188,7 +188,7 @@ def test_pull_fail(cli, tmpdir, datafiles):
},
'cachedir': cache_dir,
}
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
cli.configure(user_config)
repo = create_repo('git', str(tmpdir))
@@ -199,7 +199,7 @@ def test_pull_fail(cli, tmpdir, datafiles):
'kind': 'import',
'sources': [repo.source_config(ref=ref)]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
# get the source object
context = Context()
diff --git a/tests/sourcecache/push.py b/tests/sourcecache/push.py
index 4c652d21e..466ee1b48 100644
--- a/tests/sourcecache/push.py
+++ b/tests/sourcecache/push.py
@@ -56,7 +56,7 @@ def test_source_push(cli, tmpdir, datafiles):
},
'cachedir': cache_dir,
}
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
cli.configure(user_config)
repo = create_repo('git', str(tmpdir))
@@ -67,7 +67,7 @@ def test_source_push(cli, tmpdir, datafiles):
'kind': 'import',
'sources': [repo.source_config(ref=ref)]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
# get the source object
context = Context()
@@ -116,7 +116,7 @@ def test_push_pull(cli, datafiles, tmpdir):
},
'cachedir': cache_dir,
}
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
cli.configure(user_config)
# create repo to pull from
@@ -128,7 +128,7 @@ def test_push_pull(cli, datafiles, tmpdir):
'kind': 'import',
'sources': [repo.source_config(ref=ref)]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
res = cli.run(project=project_dir, args=['build', 'push.bst'])
res.assert_success()
@@ -162,7 +162,7 @@ def test_push_fail(cli, tmpdir, datafiles):
},
'cachedir': cache_dir,
}
- _yaml.dump(user_config, filename=user_config_file)
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
cli.configure(user_config)
# create repo to pull from
@@ -174,7 +174,7 @@ def test_push_fail(cli, tmpdir, datafiles):
'kind': 'import',
'sources': [repo.source_config(ref=ref)]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
# build and check that it fails to set up the remote
res = cli.run(project=project_dir, args=['build', 'push.bst'])
@@ -212,7 +212,7 @@ def test_source_push_build_fail(cli, tmpdir, datafiles):
'kind': 'always_fail',
'sources': [repo.source_config(ref=ref)]
}
- _yaml.dump(element, os.path.join(element_path, element_name))
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
res = cli.run(project=project_dir, args=['build', 'always-fail.bst'])
res.assert_main_error(ErrorDomain.STREAM, None)
diff --git a/tests/sources/bzr.py b/tests/sources/bzr.py
index 4a66d89b3..c6e78f8c1 100644
--- a/tests/sources/bzr.py
+++ b/tests/sources/bzr.py
@@ -32,7 +32,7 @@ def test_fetch_checkout(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
diff --git a/tests/sources/deb.py b/tests/sources/deb.py
index bdde20aaa..e536e522a 100644
--- a/tests/sources/deb.py
+++ b/tests/sources/deb.py
@@ -22,7 +22,7 @@ deb_name = "a_deb.deb"
def generate_project(project_dir, tmpdir):
project_file = os.path.join(project_dir, "project.conf")
- _yaml.dump({
+ _yaml.roundtrip_dump({
'name': 'foo',
'aliases': {
'tmpdir': "file:///" + str(tmpdir)
diff --git a/tests/sources/git.py b/tests/sources/git.py
index 7ff28114c..c280b5a5a 100644
--- a/tests/sources/git.py
+++ b/tests/sources/git.py
@@ -58,7 +58,7 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles):
repo.source_config(ref='5')
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Assert that fetch raises an error here
result = cli.run(project=project, args=[
@@ -92,7 +92,7 @@ def test_submodule_fetch_checkout(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
@@ -131,7 +131,7 @@ def test_submodule_fetch_source_enable_explicit(cli, tmpdir, datafiles):
repo.source_config_extra(ref=ref, checkout_submodules=True)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
@@ -170,7 +170,7 @@ def test_submodule_fetch_source_disable(cli, tmpdir, datafiles):
repo.source_config_extra(ref=ref, checkout_submodules=False)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
@@ -209,7 +209,7 @@ def test_submodule_fetch_submodule_does_override(cli, tmpdir, datafiles):
repo.source_config_extra(ref=ref, checkout_submodules=False)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
@@ -253,7 +253,7 @@ def test_submodule_fetch_submodule_individual_checkout(cli, tmpdir, datafiles):
repo.source_config_extra(ref=ref, checkout_submodules=True)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
@@ -298,7 +298,7 @@ def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, dat
repo.source_config_extra(ref=ref, checkout_submodules=True)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
@@ -338,7 +338,7 @@ def test_submodule_fetch_project_override(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
@@ -369,7 +369,7 @@ def test_submodule_track_ignore_inconsistent(cli, tmpdir, datafiles):
repo.source_config(ref=ref)
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Now add a .gitmodules file with an inconsistent submodule,
# we are calling this inconsistent because the file was created
@@ -409,7 +409,7 @@ def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles):
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Track will encounter an inconsistent submodule without any ref
result = cli.run(project=project, args=['show', 'target.bst'])
@@ -429,7 +429,7 @@ def test_ref_not_in_track(cli, tmpdir, datafiles, fail):
"name": "foo",
"fatal-warnings": [CoreWarnings.REF_NOT_IN_TRACK]
}
- _yaml.dump(project_template, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_template, os.path.join(project, 'project.conf'))
# Create the repo from 'repofiles', create a branch without latest commit
repo = create_repo('git', str(tmpdir))
@@ -447,7 +447,7 @@ def test_ref_not_in_track(cli, tmpdir, datafiles, fail):
gitsource
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
result = cli.run(project=project, args=['build', 'target.bst'])
@@ -472,7 +472,7 @@ def test_unlisted_submodule(cli, tmpdir, datafiles, fail):
"name": "foo",
"fatal-warnings": ['git:unlisted-submodule']
}
- _yaml.dump(project_template, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_template, os.path.join(project, 'project.conf'))
# Create the submodule first from the 'subrepofiles' subdir
subrepo = create_repo('git', str(tmpdir), 'subrepo')
@@ -501,7 +501,7 @@ def test_unlisted_submodule(cli, tmpdir, datafiles, fail):
gitsource
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# We will not see the warning or error before the first fetch, because
# we don't have the repository yet and so we have no knowledge of
@@ -545,7 +545,7 @@ def test_track_unlisted_submodule(cli, tmpdir, datafiles, fail):
"name": "foo",
"fatal-warnings": ['git:unlisted-submodule']
}
- _yaml.dump(project_template, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_template, os.path.join(project, 'project.conf'))
# Create the submodule first from the 'subrepofiles' subdir
subrepo = create_repo('git', str(tmpdir), 'subrepo')
@@ -571,7 +571,7 @@ def test_track_unlisted_submodule(cli, tmpdir, datafiles, fail):
gitsource
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch the repo, we will not see the warning because we
# are still pointing to a ref which predates the submodules
@@ -608,7 +608,7 @@ def test_invalid_submodule(cli, tmpdir, datafiles, fail):
"name": "foo",
"fatal-warnings": ['git:invalid-submodule']
}
- _yaml.dump(project_template, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_template, os.path.join(project, 'project.conf'))
# Create the repo from 'repofiles' subdir
repo = create_repo('git', str(tmpdir))
@@ -635,7 +635,7 @@ def test_invalid_submodule(cli, tmpdir, datafiles, fail):
gitsource
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# We will not see the warning or error before the first fetch, because
# we don't have the repository yet and so we have no knowledge of
@@ -680,7 +680,7 @@ def test_track_invalid_submodule(cli, tmpdir, datafiles, fail):
"name": "foo",
"fatal-warnings": ['git:invalid-submodule']
}
- _yaml.dump(project_template, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_template, os.path.join(project, 'project.conf'))
# Create the submodule first from the 'subrepofiles' subdir
subrepo = create_repo('git', str(tmpdir), 'subrepo')
@@ -707,7 +707,7 @@ def test_track_invalid_submodule(cli, tmpdir, datafiles, fail):
gitsource
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Fetch the repo, we will not see the warning because we
# are still pointing to a ref which predates the submodules
@@ -753,7 +753,7 @@ def test_track_fetch(cli, tmpdir, datafiles, ref_format, tag, extra_commit):
}
element['sources'][0]['ref-format'] = ref_format
element_path = os.path.join(project, 'target.bst')
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
# Track it
result = cli.run(project=project, args=['source', 'track', 'target.bst'])
@@ -786,7 +786,7 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
project_config = _yaml.load(os.path.join(project, 'project.conf'))
project_config['ref-storage'] = ref_storage
- _yaml.dump(project_config, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_config, os.path.join(project, 'project.conf'))
repofiles = os.path.join(str(tmpdir), 'repofiles')
os.makedirs(repofiles, exist_ok=True)
@@ -838,7 +838,7 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
],
}
element_path = os.path.join(project, 'target.bst')
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
if ref_storage == 'inline':
result = cli.run(project=project, args=['source', 'track', 'target.bst'])
@@ -900,7 +900,7 @@ def test_git_describe_head_is_tagged(cli, tmpdir, datafiles, ref_storage, tag_ty
project_config = _yaml.load(os.path.join(project, 'project.conf'))
project_config['ref-storage'] = ref_storage
- _yaml.dump(project_config, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_config, os.path.join(project, 'project.conf'))
repofiles = os.path.join(str(tmpdir), 'repofiles')
os.makedirs(repofiles, exist_ok=True)
@@ -951,7 +951,7 @@ def test_git_describe_head_is_tagged(cli, tmpdir, datafiles, ref_storage, tag_ty
],
}
element_path = os.path.join(project, 'target.bst')
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
if ref_storage == 'inline':
result = cli.run(project=project, args=['source', 'track', 'target.bst'])
@@ -1015,7 +1015,7 @@ def test_git_describe_relevant_history(cli, tmpdir, datafiles):
project_config = _yaml.load(os.path.join(project, 'project.conf'))
project_config['ref-storage'] = 'project.refs'
- _yaml.dump(project_config, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_config, os.path.join(project, 'project.conf'))
repofiles = os.path.join(str(tmpdir), 'repofiles')
os.makedirs(repofiles, exist_ok=True)
@@ -1064,7 +1064,7 @@ def test_git_describe_relevant_history(cli, tmpdir, datafiles):
],
}
element_path = os.path.join(project, 'target.bst')
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
result = cli.run(project=project, args=['source', 'track', 'target.bst', '--deps', 'all'])
result.assert_success()
@@ -1095,7 +1095,7 @@ def test_default_do_not_track_tags(cli, tmpdir, datafiles):
project_config = _yaml.load(os.path.join(project, 'project.conf'))
project_config['ref-storage'] = 'inline'
- _yaml.dump(project_config, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_config, os.path.join(project, 'project.conf'))
repofiles = os.path.join(str(tmpdir), 'repofiles')
os.makedirs(repofiles, exist_ok=True)
@@ -1119,7 +1119,7 @@ def test_default_do_not_track_tags(cli, tmpdir, datafiles):
],
}
element_path = os.path.join(project, 'target.bst')
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
result = cli.run(project=project, args=['source', 'track', 'target.bst'])
result.assert_success()
@@ -1162,7 +1162,7 @@ def test_overwrite_rogue_tag_multiple_remotes(cli, tmpdir, datafiles):
}
}
]
- _yaml.dump(project_config, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_config, os.path.join(project, 'project.conf'))
repo.add_annotated_tag('tag', 'tag')
@@ -1184,7 +1184,7 @@ def test_overwrite_rogue_tag_multiple_remotes(cli, tmpdir, datafiles):
],
}
element_path = os.path.join(project, 'target.bst')
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
@@ -1208,7 +1208,7 @@ def test_overwrite_rogue_tag_multiple_remotes(cli, tmpdir, datafiles):
repodir, reponame = os.path.split(repo.repo)
- _yaml.dump(project_config, os.path.join(project, 'project.conf'))
+ _yaml.roundtrip_dump(project_config, os.path.join(project, 'project.conf'))
config = repo.source_config(ref=new_ref)
del config['track']
@@ -1220,7 +1220,7 @@ def test_overwrite_rogue_tag_multiple_remotes(cli, tmpdir, datafiles):
config
],
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
diff --git a/tests/sources/local.py b/tests/sources/local.py
index fb5d36081..4b72a4343 100644
--- a/tests/sources/local.py
+++ b/tests/sources/local.py
@@ -217,4 +217,4 @@ def test_deterministic_source_umask(cli, tmpdir, datafiles):
]
}
}
- _yaml.dump(element, element_path)
+ _yaml.roundtrip_dump(element, element_path)
diff --git a/tests/sources/no_fetch_cached.py b/tests/sources/no_fetch_cached.py
index fcbb42398..81032881c 100644
--- a/tests/sources/no_fetch_cached.py
+++ b/tests/sources/no_fetch_cached.py
@@ -39,7 +39,7 @@ def test_no_fetch_cached(cli, tmpdir, datafiles):
}
]
}
- _yaml.dump(element, os.path.join(project, 'target.bst'))
+ _yaml.roundtrip_dump(element, os.path.join(project, 'target.bst'))
# Test fetch of target with a cached and a non-cached source
result = cli.run(project=project, args=[
diff --git a/tests/sources/pip.py b/tests/sources/pip.py
index cf6ea5498..7f91ba701 100644
--- a/tests/sources/pip.py
+++ b/tests/sources/pip.py
@@ -17,7 +17,7 @@ DATA_DIR = os.path.join(
def generate_project(project_dir):
project_file = os.path.join(project_dir, "project.conf")
- _yaml.dump({'name': 'foo'}, project_file)
+ _yaml.roundtrip_dump({'name': 'foo'}, project_file)
# Test that without ref, consistency is set appropriately.
diff --git a/tests/sources/previous_source_access.py b/tests/sources/previous_source_access.py
index 916cd5a6f..750b94381 100644
--- a/tests/sources/previous_source_access.py
+++ b/tests/sources/previous_source_access.py
@@ -26,7 +26,7 @@ def test_custom_transform_source(cli, datafiles):
project_config = _yaml.load(project_config_path)
aliases = project_config.get_mapping("aliases")
aliases["project_dir"] = "file://{}".format(project)
- _yaml.dump(project_config, project_config_path)
+ _yaml.roundtrip_dump(project_config, project_config_path)
# Ensure we can track
result = cli.run(project=project, args=[
diff --git a/tests/sources/remote.py b/tests/sources/remote.py
index 8b57151b2..5b818b960 100644
--- a/tests/sources/remote.py
+++ b/tests/sources/remote.py
@@ -18,7 +18,7 @@ DATA_DIR = os.path.join(
def generate_project(project_dir, tmpdir):
project_file = os.path.join(project_dir, "project.conf")
- _yaml.dump({
+ _yaml.roundtrip_dump({
'name': 'foo',
'aliases': {
'tmpdir': "file:///" + str(tmpdir)
@@ -28,7 +28,7 @@ def generate_project(project_dir, tmpdir):
def generate_project_file_server(server, project_dir):
project_file = os.path.join(project_dir, "project.conf")
- _yaml.dump({
+ _yaml.roundtrip_dump({
'name': 'foo',
'aliases': {
'tmpdir': server.base_url()
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index a6c1a4d9f..06a3cfc0e 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -47,7 +47,7 @@ def _assemble_tar_lz(workingdir, srcdir, dstfile):
def generate_project(project_dir, tmpdir):
project_file = os.path.join(project_dir, "project.conf")
- _yaml.dump({
+ _yaml.roundtrip_dump({
'name': 'foo',
'aliases': {
'tmpdir': "file:///" + str(tmpdir)
@@ -57,7 +57,7 @@ def generate_project(project_dir, tmpdir):
def generate_project_file_server(base_url, project_dir):
project_file = os.path.join(project_dir, "project.conf")
- _yaml.dump({
+ _yaml.roundtrip_dump({
'name': 'foo',
'aliases': {
'tmpdir': base_url
diff --git a/tests/sources/zip.py b/tests/sources/zip.py
index cb7f440f1..3fd43b4bb 100644
--- a/tests/sources/zip.py
+++ b/tests/sources/zip.py
@@ -32,7 +32,7 @@ def _assemble_zip(workingdir, dstfile):
def generate_project(project_dir, tmpdir):
project_file = os.path.join(project_dir, "project.conf")
- _yaml.dump({
+ _yaml.roundtrip_dump({
'name': 'foo',
'aliases': {
'tmpdir': "file:///" + str(tmpdir)
@@ -42,7 +42,7 @@ def generate_project(project_dir, tmpdir):
def generate_project_file_server(server, project_dir):
project_file = os.path.join(project_dir, "project.conf")
- _yaml.dump({
+ _yaml.roundtrip_dump({
'name': 'foo',
'aliases': {
'tmpdir': server.base_url()
diff --git a/tests/testutils/element_generators.py b/tests/testutils/element_generators.py
index 38bafc6b6..0fbca7f3e 100644
--- a/tests/testutils/element_generators.py
+++ b/tests/testutils/element_generators.py
@@ -59,7 +59,7 @@ def create_element_size(name, project_dir, elements_path, dependencies, size):
},
'depends': dependencies
}
- _yaml.dump(element, os.path.join(project_dir, elements_path, name))
+ _yaml.roundtrip_dump(element, os.path.join(project_dir, elements_path, name))
# Return the repo, so that it can later be used to add commits
return repo
diff --git a/tests/testutils/junction.py b/tests/testutils/junction.py
index 8132e291c..e867695c4 100644
--- a/tests/testutils/junction.py
+++ b/tests/testutils/junction.py
@@ -30,6 +30,6 @@ def generate_junction(tmpdir, subproject_path, junction_path, *, store_ref=True)
repo.source_config(ref=source_ref)
]
}
- _yaml.dump(element, junction_path)
+ _yaml.roundtrip_dump(element, junction_path)
return ref