Get dummy test suite in place.

At least isort/pylava are passing.
This commit is contained in:
Luke Murphy 2018-11-18 11:58:22 +01:00
parent c84cfef0fe
commit 0f76d1acad
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
11 changed files with 84 additions and 20 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ __pycache__/
rqlite*
xppl/cover/**
xppl/uploads/**
.tox

View File

@ -26,6 +26,7 @@ isort = "*"
molecule = "*"
pylava = "*"
pytest = "*"
tox = "*"
[scripts]
dev = "python dev.py"

31
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "ff23b231918be30a5c0e107881b3ba4d1c80fa32b8c23c111a7c5de2bc9b067a"
"sha256": "fbaf222a7097845663946321f6cfa0b2d6ddae146ffbdb0d4ce8890dfc637d64"
},
"pipfile-spec": 6,
"requires": {},
@ -652,6 +652,13 @@
],
"version": "==0.14.1"
},
"filelock": {
"hashes": [
"sha256:b8d5ca5ca1c815e1574aee746650ea7301de63d87935b3463d26368b76e31633",
"sha256:d610c1bb404daf85976d7a82eb2ada120f04671007266b708606565dd03b5be6"
],
"version": "==3.0.10"
},
"flake8": {
"hashes": [
"sha256:7253265f7abd8b313e3892944044a365e3f4ac3fcdcfb4298f55ee9ddf188ba0",
@ -1046,6 +1053,21 @@
],
"version": "==1.16.0"
},
"toml": {
"hashes": [
"sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c",
"sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e"
],
"version": "==0.10.0"
},
"tox": {
"hashes": [
"sha256:513e32fdf2f9e2d583c2f248f47ba9886428c949f068ac54a0469cac55df5862",
"sha256:75fa30e8329b41b664585f5fb837e23ce1d7e6fa1f7811f2be571c990f9d911b"
],
"index": "pypi",
"version": "==3.5.3"
},
"traitlets": {
"hashes": [
"sha256:9c4bd2d267b7153df9152698efb1050a5d84982d3384a37b2c1f7723ba3e7835",
@ -1067,6 +1089,13 @@
],
"version": "==1.24.1"
},
"virtualenv": {
"hashes": [
"sha256:686176c23a538ecc56d27ed9d5217abd34644823d6391cbeb232f42bf722baad",
"sha256:f899fafcd92e1150f40c8215328be38ff24b519cd95357fa6e78e006c7638208"
],
"version": "==16.1.0"
},
"wcwidth": {
"hashes": [
"sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e",

View File

@ -26,6 +26,14 @@ $ pipenv run dev
[Pipenv]: https://pipenv.readthedocs.io/en/latest/install/#pragmatic-installation-of-pipenv
[RQLite]: https://github.com/rqlite/rqlite
# Test It
```bash
$ pipenv run tox
```
Refer to the [tox.ini](tox.ini) for configuration options.
# Deploy It
See [ansible/README.md](ansible/README.md) for this.

0
tests/__init__.py Normal file
View File

1
tests/conftest.py Normal file
View File

@ -0,0 +1 @@
"""Pytest fixtures."""

24
tox.ini Normal file
View File

@ -0,0 +1,24 @@
[isort]
multi_line_output = 5
skip = .tox,build/*
[pylava]
skip = .tox/*,build/*
[pylava:mccabe]
complexity = 15
[tox]
skipsdist = True
envlist = py36
[testenv]
setenv =
PIPENV_IGNORE_VIRTUALENVS = 1
deps =
pipenv
commands =
pipenv install --dev
pipenv run pylava . --options=tox.ini
pipenv run isort --quiet --recursive --check-only --diff --settings-path=tox.ini
# pipenv run pytest {posargs: tests} # Note(decentral1se): add when we have tests

View File

@ -5,6 +5,7 @@ from wtforms import validators
from wtforms.fields import FormField, SelectField, StringField, SubmitField
from wtforms.fields.html5 import DecimalRangeField
from wtforms.validators import DataRequired, InputRequired
from xppl.models import Author

View File

@ -1,7 +1,6 @@
import json
import requests
from flask import request

View File

@ -2,8 +2,8 @@ import datetime
from marshmallow import Schema, ValidationError, fields
from sqlalchemy import Column, DateTime
from xppl.database import db
from xppl.database import db
authors = db.Table(
'books_authors',

View File

@ -8,24 +8,11 @@ from functools import wraps
from urllib.parse import quote as urlquote
import autocomplete
from xppl.database import db
from xppl.socketio import socketio
from xppl.cover import get_cover
from xppl.extractText import extract_text
from xppl.forms import (
AddtoStackForm, EditForm, EditStackForm,
SearchForm, StackForm, UploadForm
)
from xppl.getannot import get_annot_book, get_annot_results, get_annotations
from xppl.models import (
Author, AuthorSchema, Book, BookSchema, Chat,
ChatSchema, Instance, Potential, Stack, StackSchema,
UserIns
)
from flask import Response, abort
from flask import current_app as app
from flask import (
Response, abort, flash, jsonify, redirect,
render_template, request, send_from_directory,
url_for, current_app as app
flash, jsonify, redirect, render_template, request, send_from_directory,
url_for
)
from flask_socketio import emit
from flask_weasyprint import HTML, render_pdf
@ -33,6 +20,19 @@ from sqlalchemy.inspection import inspect
from sqlalchemy.sql.expression import func
from werkzeug.utils import secure_filename
from xppl.cover import get_cover
from xppl.database import db
from xppl.extractText import extract_text
from xppl.forms import (
AddtoStackForm, EditForm, EditStackForm, SearchForm, StackForm, UploadForm
)
from xppl.getannot import get_annot_book, get_annot_results, get_annotations
from xppl.models import (
Author, AuthorSchema, Book, BookSchema, Chat, ChatSchema, Instance,
Potential, Stack, StackSchema, UserIns
)
from xppl.socketio import socketio
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'epub', 'chm', 'mobi'])
author_schema = AuthorSchema()