autoland: run unit tests with pytest (bug 1368516) r?glob draft
authorMāris Fogels <mars@mozilla.com>
Tue, 16 May 2017 14:11:41 -0400
changeset 11115 6f642e8f907c10a4b2491b26712fab6f15132982
parent 11114 ce4a8132a4d7ee4445b3a1fe7f86b5f24eb1694f
child 11116 5ff21685584d5f98b9458b2ac88550e388da57cd
push id1688
push usermfogels@mozilla.com
push dateMon, 29 May 2017 20:09:07 +0000
reviewersglob
bugs1368516
autoland: run unit tests with pytest (bug 1368516) r?glob Configure the pytest unit test runner so it can execute tests against the autoland REST API. Added a trivial test to make sure it works. MozReview-Commit-ID: xGVdq1M2Tq
autoland/dev-requirements.txt
autoland/pytest.ini
autoland/tests/unit/test_autoland_api.py
new file mode 100644
--- /dev/null
+++ b/autoland/dev-requirements.txt
@@ -0,0 +1,8 @@
+pytest==3.0.7 \
+    --hash=sha256:66f332ae62593b874a648b10a8cb106bfdacd2c6288ed7dec3713c3a808a6017 \
+    --hash=sha256:b70696ebd1a5e6b627e7e3ac1365a4bc60aaf3495e843c1e70448966c5224cab
+pytest-flask==0.10.0 \
+    --hash=sha256:2c5a36f9033ef8b6f85ddbefaebdd4f89197fc283f94b20dfe1a1beba4b77f03 \
+    --hash=sha256:657c7de386215ab0230bee4d76ace0339ae82fcbb34e134e17a29f65032eef03
+pytest-pythonpath==0.7.1 \
+    --hash=sha256:2d506b8d7dbc2535a16c888211b7319ad32b3e73444bd9dbb1dd19427a6c7414
new file mode 100644
--- /dev/null
+++ b/autoland/pytest.ini
@@ -0,0 +1,2 @@
+[pytest]
+python_paths = autoland
new file mode 100644
--- /dev/null
+++ b/autoland/tests/unit/test_autoland_api.py
@@ -0,0 +1,17 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import pytest
+
+import autoland_rest
+
+
+@pytest.fixture
+def app():
+    return autoland_rest.app
+
+
+def test_hello(client):
+    response = client.get('/')
+    assert response.status_code == 200