Add test randomization to flesh out tests.
This commit is contained in:
parent
6f0ed08d0c
commit
eb58c5b1f6
|
@ -31,6 +31,7 @@ pytest>=3.0.3
|
||||||
pytest-cov>=2.4.0
|
pytest-cov>=2.4.0
|
||||||
pytest-mock>=1.2
|
pytest-mock>=1.2
|
||||||
pytest-bdd>=2.18.0
|
pytest-bdd>=2.18.0
|
||||||
|
pytest-random==0.02
|
||||||
|
|
||||||
# Deployment and Automation
|
# Deployment and Automation
|
||||||
invoke==0.13.0
|
invoke==0.13.0
|
||||||
|
|
|
@ -38,7 +38,7 @@ def _prepare_py_test_command(test_path, check_coverage_on='', verbosity=0, **ext
|
||||||
|
|
||||||
|
|
||||||
@inv.task
|
@inv.task
|
||||||
def server(ctx, server_host='api:5000', verbosity=0, test_tag='', wait_for_database=True):
|
def server(ctx, server_host='api:5000', verbosity=0, test_tag='', wait_for_database=True, randomize=False):
|
||||||
"""
|
"""
|
||||||
Test the API server using unit, and integration tests.
|
Test the API server using unit, and integration tests.
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ def server(ctx, server_host='api:5000', verbosity=0, test_tag='', wait_for_datab
|
||||||
:param verbosity: The amount of logging from the test. Default is 0 and is the lowest. 3 is the highest.
|
:param verbosity: The amount of logging from the test. Default is 0 and is the lowest. 3 is the highest.
|
||||||
:param test_tag: Optional tag (pytest mark) to run individually decorated tests in suite.
|
:param test_tag: Optional tag (pytest mark) to run individually decorated tests in suite.
|
||||||
:param wait_for_database: Flag whether or not to wait for the database.
|
:param wait_for_database: Flag whether or not to wait for the database.
|
||||||
|
:param randomize: Flag whether or not to randomize test order.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
db_connection = rookeries_db.get_db_connection_from_env()
|
db_connection = rookeries_db.get_db_connection_from_env()
|
||||||
|
@ -63,4 +64,7 @@ def server(ctx, server_host='api:5000', verbosity=0, test_tag='', wait_for_datab
|
||||||
)
|
)
|
||||||
if test_tag:
|
if test_tag:
|
||||||
test_command = f'{test_command} -m {test_tag}'
|
test_command = f'{test_command} -m {test_tag}'
|
||||||
|
|
||||||
|
if randomize:
|
||||||
|
test_command = f'{test_command} --random'
|
||||||
inv.run(test_command, echo=True, pty=True)
|
inv.run(test_command, echo=True, pty=True)
|
||||||
|
|
Loading…
Reference in New Issue