Browse Source

add tests for package

Charles Reid 10 months ago
parent
commit
c09315fd0f
3 changed files with 18 additions and 3 deletions
  1. 1
    0
      package/requirements.txt
  2. 4
    3
      package/setup.py
  3. 13
    0
      package/tests/test_homepage.py

+ 1
- 0
package/requirements.txt View File

@@ -0,0 +1 @@
1
+Flask>=1.0

+ 4
- 3
package/setup.py View File

@@ -1,9 +1,8 @@
1 1
 from setuptools import setup
2 2
 
3 3
 """
4
-setup.py for the-simplest-flask-package
5
-
6
-The simplest python package you can imagine that contains a flask app.
4
+setup.py for the simplest flask package,
5
+the simplest python package you can imagine that contains a flask app.
7 6
 """
8 7
 
9 8
 version="1.0"
@@ -13,6 +12,8 @@ config = {
13 12
     'version' : version,
14 13
     'install_requires': ['flask'],
15 14
     'include_package_data' : True,
15
+    'test_suite': 'nose.collector',
16
+    'tests_require': ['nose'],
16 17
     'packages': ['simple','simple.webapp'],
17 18
     'package_dir' : {
18 19
         'simple' : 'src',

+ 13
- 0
package/tests/test_homepage.py View File

@@ -0,0 +1,13 @@
1
+from simple.webapp import app
2
+import unittest
3
+
4
+class TheSimplestFlaskTest(unittest.TestCase):
5
+    def test_simple_flask_package(self):
6
+        client = app.test_client()
7
+
8
+        r = client.get('/')
9
+        assert b'Hello world!' in r.data
10
+
11
+        r = client.get('/florence')
12
+        assert b'Hello florence!' in r.data
13
+