diff --git a/.gitignore b/.gitignore index 93e14570..b68caadc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -node_modules +node_modules/ .sass-cache/ static/fonts/* .webassets-cache scss/assets +.pytest_cache/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..f26b9f40 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: python + python: + - "3.6" + script: + - python -m pytest diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..ab883082 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +test: + python -m pytest diff --git a/README.md b/README.md index 45a9de95..8f8e2b53 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # ATST +[![Build Status](https://travis-ci.org/dod-ccpo/atst.svg?branch=master)](https://travis-ci.org/dod-ccpo/atst) + ## Installation brew install python3 @@ -17,6 +19,16 @@ To start the app and watch for changes: DEBUG=1 ./app.py +## Testing + +To run unit tests: + + python -m pytest + +or + + make test + ## Notes tornado templates are like mustache templates -- add the diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..3b40ee44 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +norecursedirs = .venv .git node_modules diff --git a/requirements.txt b/requirements.txt index 69d97d96..fbddde00 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ tornado==5.0.2 webassets==0.12.1 +pytest==3.6.0 +pytest-tornado==0.5.0 diff --git a/tests/test_basic.py b/tests/test_basic.py new file mode 100644 index 00000000..b4fc343b --- /dev/null +++ b/tests/test_basic.py @@ -0,0 +1,12 @@ +import pytest +import tornado.web +from app import make_app + +@pytest.fixture +def app(): + return make_app() + +@pytest.mark.gen_test +def test_hello_world(http_client, base_url): + response = yield http_client.fetch(base_url) + assert response.code == 200