Skip to content

Commit

Permalink
Added real integration tests based on examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ereOn committed Jan 27, 2016
1 parent 6af40ae commit 5c6f4e2
Show file tree
Hide file tree
Showing 21 changed files with 127 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -55,6 +55,3 @@ docs/_build/

# PyBuilder
target/

# Default output dir
output/
1 change: 1 addition & 0 deletions examples/fruits/output/fruit_list.txt
@@ -0,0 +1 @@
Here are the fruits I like: apple, orange, banana.
25 changes: 25 additions & 0 deletions examples/vehicles/output/big_vehicles.html
@@ -0,0 +1,25 @@
<html>
<head>
<title>Big vehicles</title>
</head>
<body>
<h1>Big vehicles</h1>
<ul>




<li>Airbus A320</li>



<li>School bus</li>






</ul>
</body>
</html>
27 changes: 27 additions & 0 deletions examples/vehicles/output/small_vehicles.html
@@ -0,0 +1,27 @@
<html>
<head>
<title>Small vehicles</title>
</head>
<body>
<h1>Small vehicles</h1>
<ul>


<li>Ford Focus</li>







<li>Bicycle</li>



<li>Skateboard</li>


</ul>
</body>
</html>
4 changes: 4 additions & 0 deletions examples/words/output/words_cute_hernia.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The cute hernia.")
4 changes: 4 additions & 0 deletions examples/words/output/words_cute_pony.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The cute pony.")
4 changes: 4 additions & 0 deletions examples/words/output/words_cute_shopping cart.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The cute shopping cart.")
4 changes: 4 additions & 0 deletions examples/words/output/words_cute_sledgehammer.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The cute sledgehammer.")
4 changes: 4 additions & 0 deletions examples/words/output/words_interesting_hernia.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The interesting hernia.")
4 changes: 4 additions & 0 deletions examples/words/output/words_interesting_pony.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The interesting pony.")
4 changes: 4 additions & 0 deletions examples/words/output/words_interesting_shopping cart.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The interesting shopping cart.")
4 changes: 4 additions & 0 deletions examples/words/output/words_interesting_sledgehammer.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The interesting sledgehammer.")
4 changes: 4 additions & 0 deletions examples/words/output/words_marvellous_hernia.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The marvellous hernia.")
4 changes: 4 additions & 0 deletions examples/words/output/words_marvellous_pony.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The marvellous pony.")
4 changes: 4 additions & 0 deletions examples/words/output/words_marvellous_shopping cart.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The marvellous shopping cart.")
4 changes: 4 additions & 0 deletions examples/words/output/words_marvellous_sledgehammer.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The marvellous sledgehammer.")
4 changes: 4 additions & 0 deletions examples/words/output/words_red_hernia.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The red hernia.")
4 changes: 4 additions & 0 deletions examples/words/output/words_red_pony.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The red pony.")
4 changes: 4 additions & 0 deletions examples/words/output/words_red_shopping cart.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The red shopping cart.")
4 changes: 4 additions & 0 deletions examples/words/output/words_red_sledgehammer.py
@@ -0,0 +1,4 @@
import sys

if __name__ == '__main__':
sys.stdout.write("The red sledgehammer.")
10 changes: 10 additions & 0 deletions tests/integration/test_examples.py
@@ -1,6 +1,7 @@
import os

from functools import partial
from filecmp import dircmp

from click.testing import CliRunner
from pytest import (
Expand Down Expand Up @@ -29,6 +30,13 @@ def run(*args):
return run


def compare_folders(left, right):
cmp = dircmp(str(left), str(right))
assert cmp.left_only == []
assert cmp.right_only == []
assert cmp.diff_files == []


@mark.parametrize('folder,index_file,data_file', [
('examples/fruits', 'index.yml', 'data.yml'),
('examples/vehicles', 'index.yml', 'data.json'),
Expand All @@ -37,3 +45,5 @@ def run(*args):
def test_examples(tmpdir, runner, index_file, data_file):
result = runner(index_file, data_file, '-o', tmpdir.join('output'))
assert result.exit_code == 0

compare_folders('output', tmpdir.join('output'))

0 comments on commit 5c6f4e2

Please sign in to comment.