-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into v03_with_new_fields
- Loading branch information
Showing
12 changed files
with
209 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [master,main] | ||
|
||
jobs: | ||
run: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Micromamba | ||
uses: mamba-org/provision-with-micromamba@main | ||
with: | ||
environment-file: false | ||
|
||
- name: Python ${{ matrix.python-version }} | ||
shell: bash -l {0} | ||
run: | | ||
micromamba create --name TEST python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt --channel conda-forge | ||
micromamba activate TEST | ||
python -m pip install -e . --no-deps --force-reinstall | ||
- name: Tests | ||
shell: bash -l {0} | ||
run: | | ||
micromamba activate TEST | ||
python -m pytest -rxs tests |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
docopt | ||
netCDF4 | ||
ruamel.yaml | ||
six |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
from __future__ import (absolute_import, division, print_function) | ||
|
||
import subprocess | ||
import tempfile | ||
from pathlib import Path | ||
|
||
import pytest | ||
import ruamel.yaml as yaml | ||
|
||
from yaml2ncml import build | ||
|
||
path = Path(__file__).parent.resolve() | ||
|
||
|
||
def test_call(): | ||
output = subprocess.check_output(['yaml2ncml', 'roms_0.yaml']) | ||
with open('base_roms_test.ncml') as f: | ||
expected = f.read() | ||
assert output.decode() == expected | ||
fname = str(path.joinpath("roms_0.yaml")) | ||
output = subprocess.check_output(["yaml2ncml", fname]).decode() | ||
output = [line.strip() for line in output.splitlines()] | ||
with path.joinpath("base_roms_test.ncml").open() as f: | ||
expected = [line.strip() for line in f.read().splitlines()] | ||
assert output == expected | ||
|
||
|
||
def test_save_file(): | ||
outfile = tempfile.mktemp(suffix='.ncml') | ||
subprocess.call(['yaml2ncml', | ||
'roms_0.yaml', | ||
'--output={}'.format(outfile)]) | ||
with open('base_roms_test.ncml') as f: | ||
outfile = tempfile.mktemp(suffix=".ncml") | ||
fname = str(path.joinpath("roms_0.yaml")) | ||
subprocess.call(["yaml2ncml", fname, f"--output={outfile}"]) | ||
with path.joinpath("base_roms_test.ncml").open() as f: | ||
expected = f.read() | ||
with open(outfile) as f: | ||
output = f.read() | ||
assert output == expected | ||
|
||
|
||
@pytest.fixture | ||
def load_ymal(fname='roms_1.yaml'): | ||
with open(fname, 'r') as stream: | ||
yml = yaml.load(stream, Loader=yaml.RoundTripLoader) | ||
return yml | ||
def load_ymal(fname=path.joinpath("roms_1.yaml")): | ||
with open(fname) as stream: | ||
yield yaml.load(stream, Loader=yaml.RoundTripLoader) | ||
|
||
|
||
def test_bad_yaml(): | ||
def test_bad_yaml(load_ymal): | ||
with pytest.raises(ValueError): | ||
yml = load_ymal(fname='roms_1.yaml') | ||
build(yml) | ||
build(load_ymal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
from __future__ import (absolute_import, division, print_function) | ||
from yaml2ncml.yaml2ncml import build, main | ||
|
||
from yaml2ncml.yaml2ncml import main, build | ||
__version__ = "0.7.3" | ||
|
||
|
||
__version__ = '0.7.2' | ||
|
||
__all__ = [ | ||
'main', | ||
'build' | ||
] | ||
__all__ = ["main", "build"] |
Oops, something went wrong.