ci: add a --slow options to also run slow tests (#46988)
This commit is contained in:
parent
dbf6059678
commit
9d9e34ee6a
|
@ -35,6 +35,7 @@ PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt
|
|||
sh """
|
||||
virtualenv -p python3 ${env.TMPDIR}/venv/
|
||||
${env.TMPDIR}/venv/bin/pip install tox
|
||||
PYTESTOPTIONS=--slow \
|
||||
PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0)); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` pg_virtualenv -o fsync=off ${env.TMPDIR}/venv/bin/tox -r"""
|
||||
}
|
||||
post {
|
||||
|
|
|
@ -45,6 +45,29 @@ from authentic2.authentication import OIDCUser
|
|||
|
||||
from . import utils
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
"--slow",
|
||||
action="store_true",
|
||||
help="run slow tests",
|
||||
)
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
# register an additional marker
|
||||
config.addinivalue_line(
|
||||
"markers", "slow: mark test as slow"
|
||||
)
|
||||
|
||||
|
||||
def pytest_runtest_setup(item):
|
||||
markers = list(item.iter_markers(name='slow'))
|
||||
slow = item.config.getoption('--slow')
|
||||
if markers and not slow:
|
||||
pytest.skip('slow tests must not run')
|
||||
|
||||
|
||||
Role = get_role_model()
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# authentic2 - versatile identity manager
|
||||
# Copyright (C) 2010-2020 Entr'ouvert
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
"--slow",
|
||||
action="store_true",
|
||||
help="run slow tests",
|
||||
)
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
# register an additional marker
|
||||
config.addinivalue_line(
|
||||
"markers", "slow: mark test as slow"
|
||||
)
|
||||
|
||||
|
||||
def pytest_runtest_setup(item):
|
||||
markers = list(item.iter_markers(name='slow'))
|
||||
slow = item.config.getoption('--slow')
|
||||
if markers and not slow:
|
||||
pytest.skip('slow tests must not run')
|
|
@ -1,4 +1,19 @@
|
|||
import pytest
|
||||
# authentic2 - versatile identity manager
|
||||
# Copyright (C) 2010-2020 Entr'ouvert
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import time
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
|
@ -6,9 +21,10 @@ from django.contrib.contenttypes.models import ContentType
|
|||
from django.test.utils import CaptureQueriesContext
|
||||
from django.db import connection
|
||||
|
||||
|
||||
from django_rbac import utils, models, backends
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_role_parenting(db):
|
||||
OrganizationalUnit = utils.get_ou_model()
|
||||
|
@ -70,6 +86,7 @@ SIZE = 1000
|
|||
SPAN = 50
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_massive_role_parenting(db):
|
||||
|
||||
User = get_user_model()
|
||||
|
|
5
tox.ini
5
tox.ini
|
@ -37,6 +37,7 @@ setenv =
|
|||
fast: FAST=--nomigrations
|
||||
reusedb: REUSEDB=--reuse-db
|
||||
!nosw: SW={tty:--sw:}
|
||||
slow: PYTESTOPTIONS={env:PYTESTOPTIONS:} --slow
|
||||
passenv=
|
||||
BRANCH_NAME
|
||||
# support for pg_virtualenv
|
||||
|
@ -44,6 +45,7 @@ passenv=
|
|||
PGHOST
|
||||
PGUSER
|
||||
PGPASSWORD
|
||||
PYTESTOPTIONS
|
||||
deps =
|
||||
pip > 9
|
||||
dj111: django<2.0
|
||||
|
@ -65,6 +67,7 @@ deps =
|
|||
httmock
|
||||
pytz
|
||||
pytest-freezegun
|
||||
faker
|
||||
enum34<=1.1.6
|
||||
ldaptools>=0.15
|
||||
oldldap: python-ldap<3
|
||||
|
@ -78,7 +81,7 @@ commands =
|
|||
py2: ./getlasso.sh
|
||||
py3: ./getlasso3.sh
|
||||
authentic: ./check-migrations.sh
|
||||
rbac,authentic: py.test {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {env:SW:} {posargs:{env:TESTS} --random-group}
|
||||
rbac,authentic: py.test {env:PYTESTOPTIONS:} {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {env:SW:} {posargs:{env:TESTS} --random-group}
|
||||
|
||||
[testenv:pylint]
|
||||
basepython = python2.7
|
||||
|
|
Loading…
Reference in New Issue