From 487cb147bb558129648a80184bc456d12d6fc2e8 Mon Sep 17 00:00:00 2001 From: Brian Duggan Date: Thu, 24 May 2018 12:27:41 -0400 Subject: [PATCH 1/3] Add a basic test --- .gitignore | 3 ++- .travis.yml | 5 +++++ pytest.ini | 2 ++ requirements.txt | 2 ++ tests/test_basic.py | 12 ++++++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100644 pytest.ini create mode 100644 tests/test_basic.py 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/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 From 1c5099db11638a1adadaf2e4d7af4d6bef3f5f5d Mon Sep 17 00:00:00 2001 From: Brian Duggan Date: Thu, 24 May 2018 12:29:10 -0400 Subject: [PATCH 2/3] README --- Makefile | 2 ++ README.md | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 Makefile 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..6f412534 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,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 From 85503e5e8cfb68d6d3c1ead6c1120cadea29ecc1 Mon Sep 17 00:00:00 2001 From: Brian Duggan Date: Thu, 24 May 2018 12:32:31 -0400 Subject: [PATCH 3/3] Add travis badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6f412534..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