[Test] Added setup.cfg to run tests and coverage, updated Readme

This commit is contained in:
Ferdinand Thiessen 2021-01-24 16:19:46 +01:00
parent 9bbae33e4c
commit d2854315c1
3 changed files with 28 additions and 8 deletions

View File

@ -9,9 +9,9 @@
or with ldap support or with ldap support
pip3 install --user ".[ldap]" pip3 install --user ".[ldap]"
or if you want to use bjoern as the HTTP server: or if you want to also run the tests:
pip3 install --user ".[ldap,bjoern]" pip3 install --user ".[ldap,test]"
#### Windows #### Windows
Same as above, but for mysql you have to follow this guide: Same as above, but for mysql you have to follow this guide:
@ -19,7 +19,7 @@ Same as above, but for mysql you have to follow this guide:
https://www.radishlogic.com/coding/python-3/installing-mysqldb-for-python-3-in-windows/ https://www.radishlogic.com/coding/python-3/installing-mysqldb-for-python-3-in-windows/
### Configuration ### Configuration
1. Rename `flaschengeist.example.cfg` to `flaschengeist.cfg` 1. Rename `flaschengeist.example.toml` to `flaschengeist.toml`
2. Move it to either 2. Move it to either
1. the module path (where flaschegeist is installed) 1. the module path (where flaschegeist is installed)
2. `~/.config/` 2. `~/.config/`
@ -27,13 +27,24 @@ https://www.radishlogic.com/coding/python-3/installing-mysqldb-for-python-3-in-w
3. Change at least the database parameters 3. Change at least the database parameters
### Database installation ### Database installation
run_flaschengeist --install run_flaschengeist install
### Run ### Run
run_flaschengeist run_flaschengeist run
or with debug messages: or with debug messages:
run_flaschengeist --debug run_flaschengeist run --debug
## Tests
$ pip install '.[test]'
$ pytest
Run with coverage report:
$ coverage run -m pytest
$ coverage report
Or with html output (open `htmlcov/index.html` in a browser):
$ coverage html
## Development ## Development
### Code Style ### Code Style
@ -74,7 +85,7 @@ Or if you just want to use `git blame`, configure git like this:
example_bp = Blueprint("example", __name__, url_prefix="/example") example_bp = Blueprint("example", __name__, url_prefix="/example")
permissions = {"EXAMPLE_HELLO": "example_hello"} permissions = ["example_hello"]
class PluginExample(Plugin): class PluginExample(Plugin):
def __init__(self, conf): def __init__(self, conf):

9
setup.cfg Normal file
View File

@ -0,0 +1,9 @@
[bdist_wheel]
universal = True
[tool:pytest]
testpaths = tests
[coverage:run]
branch = True
source = flaschengeist

View File

@ -21,7 +21,7 @@ setup(
# Needed for python < 3.7 # Needed for python < 3.7
"backports-datetime-fromisoformat", "backports-datetime-fromisoformat",
], ],
extras_require={"ldap": ["flask_ldapconn", "ldap3"], "tests": ["pytest"]}, extras_require={"ldap": ["flask_ldapconn", "ldap3"], "test": ["pytest", "coverage"]},
entry_points={ entry_points={
"flaschengeist.plugin": [ "flaschengeist.plugin": [
# Authentication providers # Authentication providers