diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-05-16 09:58:35 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-05-16 09:58:35 -0400 |
commit | db949eb7a2e8e28d9808a638ae283de57043ab52 (patch) | |
tree | f41913c893b3a18f98195cb5159b0abf4b1e6cd4 /tests | |
parent | 39b5aaff1550ce5bdb1982a6f0c532d5a975e7d2 (diff) | |
download | delivery_merge-db949eb7a2e8e28d9808a638ae283de57043ab52.tar.gz |
Implement force_yaml_channels()
* Switch from pyyaml to ruamel.yaml
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_merge.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_merge.py b/tests/test_merge.py index b6a885f..8ffe383 100644 --- a/tests/test_merge.py +++ b/tests/test_merge.py @@ -1,6 +1,7 @@ import os import pytest from delivery_merge import conda, merge +from ruamel.yaml import YAML CHANNELS = ['http://ssb.stsci.edu/astroconda', @@ -28,6 +29,16 @@ https://repo.anaconda.com/pkgs/main/linux-64/setuptools-41.0.1-py37_0.tar.bz2 https://repo.anaconda.com/pkgs/main/linux-64/wheel-0.33.1-py37_0.tar.bz2 https://repo.anaconda.com/pkgs/main/linux-64/pip-19.1-py37_0.tar.bz2 """ +BASE_YML = """name: simple_env +channels: + - this + - order + - i + - want +dependencies: + - some_package=1.2.3 +""" +CHANNELS_YML = ['i', 'want', 'this', 'order'] COMMENTS_DELIM = [';', '#'] COMMENTS = """; comment ; comment ; comment @@ -67,6 +78,7 @@ class TestMerge: self.input_file = 'sample.dm' self.input_file_invalid = 'sample_invalid.dm' self.input_file_empty = 'sample_empty.dm' + self.yaml = YAML() open(self.input_file, 'w+').write(DMFILE) open(self.input_file_invalid, 'w+').write(DMFILE_INVALID) open(self.input_file_empty, 'w+').write("") @@ -156,3 +168,10 @@ class TestMerge: assert 'junit_family = xunit2' in open('setup.cfg').read() os.remove('setup.cfg') + def test_force_yaml_channels(self): + filename = 'channels.yml' + open(filename, 'w+').write(BASE_YML) + assert self.yaml.load(open(filename))['channels'] + merge.force_yaml_channels('channels.yml', CHANNELS_YML) + assert self.yaml.load(open(filename))['channels'] == CHANNELS_YML + |