Skip to content
Snippets Groups Projects
Commit 3bda244a authored by nimrod's avatar nimrod
Browse files

Merge branch 'bats'

parents ef78c2d9 a56bcfc9
Branches
Tags
No related merge requests found
...@@ -2,13 +2,7 @@ ...@@ -2,13 +2,7 @@
sha: v0.7.1 sha: v0.7.1
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
- id: check-json
- id: check-xml
- id: check-yaml - id: check-yaml
- id: check-merge-conflict - id: check-merge-conflict
- id: flake8 - id: flake8
- id: check-symlinks - id: check-symlinks
- repo: https://www.shore.co.il/git/shell-pre-commit/
sha: v0.5.3
hooks:
- id: shell-lint
...@@ -19,8 +19,11 @@ matrix: ...@@ -19,8 +19,11 @@ matrix:
- python: "3.2" - python: "3.2"
install: install:
- git clone --depth 1 https://github.com/sstephenson/bats "$HOME/bats"
- pip install tox-travis | cat - pip install tox-travis | cat
env:
PATH: "$PATH:$HOME/bats/bin"
script: script:
- tox - tox
......
recursive-include template *.py recursive-include template *.py
exclude .pre-commit-config.yaml exclude .pre-commit-config.yaml
exclude *.bats
include *.rst include *.rst
include VERSION include VERSION
include *.txt include *.txt
...@@ -43,21 +43,20 @@ The following Jinja filters were added: ...@@ -43,21 +43,20 @@ The following Jinja filters were added:
- :code:`from_yaml`: Convert from yaml. - :code:`from_yaml`: Convert from yaml.
- :code:`to_json`: Convert to json. - :code:`to_json`: Convert to json.
- :code:`from_json`: Convert from json. - :code:`from_json`: Convert from json.
- :code:`combine`: Combine 2 dictionaries.
- :code:`to_toml`: Convert to toml. - :code:`to_toml`: Convert to toml.
- :code:`from_toml`: Convert from toml. - :code:`from_toml`: Convert from toml.
- :code:`jmespath`: Queries data using the `JMESPath <http://jmespath.org/>`_ - :code:`jmespath`: Queries data using the `JMESPath <http://jmespath.org/>`_
query language. query language.
Example usage can be seen in :code:`tests.sh` and for specific filters in the Example usage can be seen in :code:`tests` and for specific filters in the
docstrings in :code:`template/filters.py`. docstrings in :code:`template/filters.py`.
Testing Testing
------- -------
Tests require Python 2.7, Python 3.3 or later and Tox and are run by running Tests require Python 2.7, Python 3.3 or later, Tox and Bats and are run by
:code:`tox`. Also, Travis CI is used to test on multiple Python versions for running :code:`tox`. Also, Travis CI is used to test on multiple Python
every push. versions for every push.
Release Release
------- -------
......
0.4.3 0.4.4
\ No newline at end of file \ No newline at end of file
#!/bin/sh
set -eu
export infile="$(mktemp)"
export outfile="$(mktemp)"
echo Basic test.
export name='John'
test "$(echo 'Hello {{ name if name is defined else 'world' }}.' | template)" = "Hello John."
echo Testing arguments and reading/ writing to file.
echo '{{ name }}' > "$infile"
export name='John'
template --output "$outfile" "$infile"
test "$(cat $outfile)" = "$name"
rm "$infile" "$outfile"
{{ name }}
#!/usr/bin/env bats
export name='John'
@test "Basic test" {
run sh -c "echo 'Hello {{ name }}.' | template"
[ "$output" = "Hello John." ]
}
@test "Test arguments and reading and to/ from a file" {
template --output "$BATS_TMPDIR/output" "$BATS_TEST_DIRNAME/input"
run cat "$BATS_TMPDIR/output"
[ "$output" = "John" ]
}
...@@ -19,12 +19,14 @@ deps = ...@@ -19,12 +19,14 @@ deps =
readme_renderer readme_renderer
flake8 flake8
six six
whitelist_externals =
bats
commands = commands =
check-manifest --ignore tox.ini,tests* check-manifest --ignore tox.ini,tests*
python setup.py check --metadata --strict python setup.py check --metadata --strict
flake8 . flake8 .
python -m doctest template/filters.py template/__init__.py python -m doctest template/filters.py template/__init__.py
./tests.sh bats -t tests
[testenv:docs] [testenv:docs]
basepython = python basepython = python
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment