Merge branch 'upgrade-dependencies' into teal3

This commit is contained in:
Santiago L 2022-04-05 14:03:02 +02:00
commit 47a167b947
8 changed files with 58 additions and 60 deletions

View File

@ -47,7 +47,7 @@ jobs:
sudo apt-get update -qy
sudo apt-get -y install postgresql-client --no-install-recommends
python -m pip install --upgrade pip
pip install flake8 pytest coverage
pip install -r requirements-testing.txt
pip install -r requirements.txt
- name: Prepare database

3
pytest.ini Normal file
View File

@ -0,0 +1,3 @@
[pytest]
markers =
mvp: mark tests as required by MVP

4
requirements-testing.txt Normal file
View File

@ -0,0 +1,4 @@
coverage
flake8
pytest==7.0.0
requests-mock==1.5.2

View File

@ -12,35 +12,32 @@ Flask-Cors==3.0.10
Flask-Login==0.5.0
Flask-SQLAlchemy==2.3.2
Flask-WTF==1.0.0
flask-WeasyPrint==0.5
hashids==1.2.0
inflection==0.3.1
# lock itsdangerous version until upgrade to Flask 2.x
itsdangerous==2.0.1
# lock Jinja2 version because it's the latest compatible with Flask 1.0.X
# see related info on https://github.com/pallets/jinja/issues/1628
Jinja2==3.0.3
marshmallow==3.0.0b11
marshmallow-enum==1.4.1
more-itertools==8.12.0
passlib==1.7.1
phonenumbers==8.9.11
pytest==3.7.2
pytest-runner==4.2
psycopg2-binary==2.8.3
PyJWT==2.0.0a1
python-dateutil==2.7.3
python-decouple==3.3
python-stdnum==1.9
PyYAML==5.4
requests[security]==2.27.1
requests-mock==1.5.2
sortedcontainers==2.1.0
SQLAlchemy==1.3.24
sqlalchemy-citext==1.3.post0
SQLAlchemy-Utils==0.33.11
# teal under development version
-e git+https://github.com/eReuse/teal/@upgrade-dependencies#egg=teal
WeasyPrint==44
webargs==5.5.3
Werkzeug>=2.0
sqlalchemy-citext==1.3.post0
flask-weasyprint==0.5
weasyprint==44
psycopg2-binary==2.8.3
sortedcontainers==2.1.0
tqdm==4.32.2
python-decouple==3.3
python-dotenv==0.14.0
pyjwt==2.0.0a1

View File

@ -3,11 +3,6 @@ from setuptools import find_packages, setup
from ereuse_devicehub import __version__
test_requires = [
'pytest',
'requests_mock'
]
setup(
name='ereuse-devicehub',
version=__version__,
@ -52,17 +47,12 @@ setup(
'docs-auto': [
'sphinx-autobuild'
],
'test': test_requires
},
tests_require=test_requires,
entry_points={
'console_scripts': [
'dh = ereuse_devicehub.cli:cli'
]
},
setup_requires=[
'pytest-runner'
],
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Environment :: Web Environment',
@ -71,8 +61,7 @@ setup(
'License :: OSI Approved :: GNU Affero General Public License v3',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
'Topic :: Software Development :: Libraries :: Python Modules',

View File

@ -75,14 +75,14 @@ def test_erase_basic():
def test_validate_device_data_storage():
"""Checks the validation for data-storage-only actions works."""
# We can't set a GraphicCard
with pytest.raises(TypeError,
message='EraseBasic.device must be a DataStorage '
'but you passed <GraphicCard None model=\'foo-bar\' S/N=\'foo\'>'):
with pytest.raises(TypeError):
models.EraseBasic(
device=GraphicCard(serial_number='foo', manufacturer='bar', model='foo-bar'),
clean_with_zeros=True,
**conftest.T
)
pytest.fail('EraseBasic.device must be a DataStorage '
'but you passed <GraphicCard None model=\'foo-bar\' S/N=\'foo\'>')
@pytest.mark.mvp

View File

@ -24,11 +24,14 @@ def test_authenticate_error(app: Devicehub):
MESSAGE = 'Provide a suitable token.'
create_user()
# Token doesn't exist
with pytest.raises(Unauthorized, message=MESSAGE):
with pytest.raises(Unauthorized):
app.auth.authenticate(token=str(uuid4()))
pytest.fail(MESSAGE)
# Wrong token format
with pytest.raises(Unauthorized, message=MESSAGE):
with pytest.raises(Unauthorized):
app.auth.authenticate(token='this is a wrong uuid')
pytest.fail(MESSAGE)
@pytest.mark.mvp

View File

@ -144,5 +144,7 @@ def test_create_existing_inventory(cli, tdb1):
cli.invoke('inv', 'add', '--common')
with tdb1.app_context():
assert db.has_schema('tdb1')
with pytest.raises(AssertionError, message='Schema tdb1 already exists.'):
with pytest.raises(AssertionError):
cli.invoke('inv', 'add', '--common')
pytest.fail('Schema tdb1 already exists.')