tests & travis

This commit is contained in:
Daniel 2020-03-14 18:56:04 +01:00
parent 57532babf6
commit fa00841df6
5 changed files with 51 additions and 5 deletions

View file

@ -1,5 +1,7 @@
language: python
python:
- "3.6"
install: pip install .
python: 3.6
install:
- pip install .
- pip install -r requirements.txt
script: pytest
sudo: false

3
requirements.txt Normal file
View file

@ -0,0 +1,3 @@
flask-debug
flask-wtf
pytest

13
sample.py Normal file
View file

@ -0,0 +1,13 @@
from flask import Flask
from .flask_semanticui import SemanticUI
def create_app():
app = Flask(__name__)
SemanticUI(app)
@app.route('/')
def hello():
return 'Hello, World!'
return app

View file

@ -11,7 +11,6 @@ setup(
packages=['flask_semanticui'],
include_package_data=True,
install_requires=[
'Flask>=1.0',
'flask_wtf>=0.14'
'Flask>=1.0'
]
)

29
test_sample.py Normal file
View file

@ -0,0 +1,29 @@
import pytest
@pytest.fixture
def app():
import sys
sys.path.append('.')
from sample import create_app
app = create_app()
app.debug = True
app.testing = True
# manually add flask-debug
from flask_debug import Debug
Debug(app)
return app
@pytest.fixture
def client(app):
return app.test_client()
def test_index(client):
resp = client.get('/')
assert resp.status_code == 200