diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2019-05-16 10:17:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-16 10:17:18 -0400 |
commit | 5c3adc2fbaebaca2324d1ff86f19e23a3fabd012 (patch) | |
tree | f41913c893b3a18f98195cb5159b0abf4b1e6cd4 /tests/test_merge.py | |
parent | fe759e1a7a5052339d00411c4162f3242bb5141b (diff) | |
parent | db949eb7a2e8e28d9808a638ae283de57043ab52 (diff) | |
download | delivery_merge-5c3adc2fbaebaca2324d1ff86f19e23a3fabd012.tar.gz |
Merge pull request #2 from astroconda/yaml-channels
Reset YAML channels
Diffstat (limited to 'tests/test_merge.py')
-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 + |