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

- Removed combine filter from README, was removed from code previously.

- Replaced test shell script with Bats tests, update Travis CI and README
  accordingly.
- Removed unused pre-commit hooks.
- Bumped patch version.
parent ef78c2d9
No related branches found
No related tags found
No related merge requests found
......@@ -2,13 +2,7 @@
sha: v0.7.1
hooks:
- id: check-added-large-files
- id: check-json
- id: check-xml
- id: check-yaml
- id: check-merge-conflict
- id: flake8
- 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:
- python: "3.2"
install:
- git clone --depth 1 https://github.com/sstephenson/bats "$HOME/bats"
- pip install tox-travis | cat
env:
PATH: "$PATH:$HOME/bats/bin"
script:
- tox
......
recursive-include template *.py
exclude .pre-commit-config.yaml
exclude *.bats
include *.rst
include VERSION
include *.txt
......@@ -43,21 +43,20 @@ The following Jinja filters were added:
- :code:`from_yaml`: Convert from yaml.
- :code:`to_json`: Convert to json.
- :code:`from_json`: Convert from json.
- :code:`combine`: Combine 2 dictionaries.
- :code:`to_toml`: Convert to toml.
- :code:`from_toml`: Convert from toml.
- :code:`jmespath`: Queries data using the `JMESPath <http://jmespath.org/>`_
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`.
Testing
-------
Tests require Python 2.7, Python 3.3 or later and Tox and are run by running
:code:`tox`. Also, Travis CI is used to test on multiple Python versions for
every push.
Tests require Python 2.7, Python 3.3 or later, Tox and Bats and are run by
running :code:`tox`. Also, Travis CI is used to test on multiple Python
versions for every push.
Release
-------
......
0.4.3
\ No newline at end of file
0.4.4
\ 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 =
readme_renderer
flake8
six
whitelist_externals =
bats
commands =
check-manifest --ignore tox.ini,tests*
python setup.py check --metadata --strict
flake8 .
python -m doctest template/filters.py template/__init__.py
./tests.sh
bats -t tests
[testenv:docs]
basepython = python
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment