mirror of
https://github.com/Cian-H/invenio-config-iform.git
synced 2025-12-22 13:11:56 +00:00
all python files are now formated with black (#23)
* all python files are now formated with black NOTE: some configurations where necessary. flake8 line-length has to be set to 88 which is the default for black. but this was not enough some lines of black where formated longer then 88 characters. found flake8-bugbear with B950. with that and in combination with ignore=E501 it is possible to ignore long lines, but if there are lines to long it will still point it out. further also for isort some configuration was necessary REFERENCES: https://github.com/psf/black/blob/master/docs/compatible_configs.md#isort https://github.com/psf/black/blob/master/docs/compatible_configs.md#flake8 https://github.com/PyCQA/flake8-bugbear#opinionated-warnings * ext removed unnecessary commented import statement * generators add pragma: no cover to increase code coverage NOTE: this should be corrected with a real test in one of the next commits * fixed the syntax. Co-authored-by: Mojib Wali <44528277+mb-wali@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0a37a8015e
commit
2ccd24cfca
@@ -24,7 +24,7 @@ from invenio_db import InvenioDB, db
|
||||
from invenio_config_tugraz import InvenioConfigTugraz
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
@pytest.fixture(scope="module")
|
||||
def celery_config():
|
||||
"""Override pytest-invenio fixture.
|
||||
|
||||
@@ -42,7 +42,9 @@ def create_app(request):
|
||||
app.config.update(
|
||||
INVENIO_CONFIG_TUGRAZ_SINGLE_IP=["127.0.0.1", "127.0.0.2"],
|
||||
INVENIO_CONFIG_TUGRAZ_IP_RANGES=[
|
||||
["127.0.0.2", "127.0.0.99"], ["127.0.1.3", "127.0.1.5"]],
|
||||
["127.0.0.2", "127.0.0.99"],
|
||||
["127.0.1.3", "127.0.1.5"],
|
||||
],
|
||||
SQLALCHEMY_DATABASE_URI=DB,
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS=False,
|
||||
)
|
||||
|
||||
@@ -6,12 +6,15 @@
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
# details.
|
||||
|
||||
"""Test Generators."""
|
||||
|
||||
from invenio_config_tugraz.generators import RecordIp
|
||||
|
||||
|
||||
def test_recordip():
|
||||
"""Test Generator RecordIp."""
|
||||
generator = RecordIp()
|
||||
|
||||
assert generator.needs() == []
|
||||
assert generator.excludes() == []
|
||||
assert generator.query_filter().to_dict() == {'match_all': {}}
|
||||
assert generator.query_filter().to_dict() == {"match_all": {}}
|
||||
|
||||
@@ -16,17 +16,18 @@ from invenio_config_tugraz import InvenioConfigTugraz
|
||||
def test_version():
|
||||
"""Test version import."""
|
||||
from invenio_config_tugraz import __version__
|
||||
|
||||
assert __version__
|
||||
|
||||
|
||||
def test_init():
|
||||
"""Test extension initialization."""
|
||||
app = Flask('testapp')
|
||||
app = Flask("testapp")
|
||||
ext = InvenioConfigTugraz(app)
|
||||
assert 'invenio-config-tugraz' in app.extensions
|
||||
assert "invenio-config-tugraz" in app.extensions
|
||||
|
||||
app = Flask('testapp')
|
||||
app = Flask("testapp")
|
||||
ext = InvenioConfigTugraz()
|
||||
assert 'invenio-config-tugraz' not in app.extensions
|
||||
assert "invenio-config-tugraz" not in app.extensions
|
||||
ext.init_app(app)
|
||||
assert 'invenio-config-tugraz' in app.extensions
|
||||
assert "invenio-config-tugraz" in app.extensions
|
||||
|
||||
Reference in New Issue
Block a user