diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 0de1077e..dc41463f 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -71,6 +71,7 @@ Listed in alphabetical order. Bo Lopker `@blopker`_ Bouke Haarsma Brent Payne `@brentpayne`_ @brentpayne + Bartek `@btknu` Burhan Khalid            `@burhan`_                   @burhan Carl Johnson `@carlmjohnson`_ @carlmjohnson Catherine Devlin `@catherinedevlin`_ @@ -299,6 +300,7 @@ Listed in alphabetical order. .. _@umrashrf: https://github.com/umrashrf .. _@ahhda: https://github.com/ahhda .. _@keithjeb: https://github.com/keithjeb +.. _@btknu: https://github.com/btknu Special Thanks ~~~~~~~~~~~~~~ diff --git a/requirements.txt b/requirements.txt index dabb5dd9..37a96913 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ flake8==3.7.6 tox==3.6.1 pytest==4.3.0 pytest-cookies==0.3.0 +pyyaml==3.13 diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index cf173576..b2c235a8 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -1,6 +1,7 @@ import os import re import sh +import yaml import pytest from binaryornot.check import is_binary @@ -85,3 +86,19 @@ def test_flake8_compliance(cookies): sh.flake8(str(result.project)) except sh.ErrorReturnCode as e: pytest.fail(e) + + +def test_travis_invokes_pytest(cookies, context): + context.update({"use_travisci": "y"}) + result = cookies.bake(extra_context=context) + + assert result.exit_code == 0 + assert result.exception is None + assert result.project.basename == context["project_slug"] + assert result.project.isdir() + + with open(f'{result.project}/.travis.yml', 'r') as travis_yml: + try: + assert yaml.load(travis_yml)['script'] == ['pytest'] + except yaml.YAMLError as e: + pytest.fail(e) diff --git a/{{cookiecutter.project_slug}}/.travis.yml b/{{cookiecutter.project_slug}}/.travis.yml index 5ca54d00..3072f75f 100644 --- a/{{cookiecutter.project_slug}}/.travis.yml +++ b/{{cookiecutter.project_slug}}/.travis.yml @@ -9,3 +9,7 @@ before_install: language: python python: - "3.6" +install: + - pip install -r requirements/local.txt +script: + - "pytest"