From 4feedc280b5e47e7880352d0127a9e5db254608c Mon Sep 17 00:00:00 2001 From: Alberto Contreras Date: Tue, 14 Jun 2022 15:51:27 +0200 Subject: [PATCH] Add new tox env to run long hypothesis tests Revert .travis as long tests are going to be run in Jenkins. --- .travis.yml | 6 ++-- tests/unittests/config/test_schema.py | 1 + tox.ini | 41 +++++++++++++++++++-------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index d7238bcb88f..9213a5c173e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,8 +35,7 @@ script: env: TOXENV=py3 - PYTEST_ADDOPTS=-v - HYPOTHESIS_PROFILE=ci + PYTEST_ADDOPTS=-v # List all tests run by pytest matrix: fast_finish: true @@ -129,8 +128,7 @@ matrix: - python: 3.6 env: TOXENV=lowest-supported - PYTEST_ADDOPTS=-v - HYPOTHESIS_PROFILE=ci + PYTEST_ADDOPTS=-v # List all tests run by pytest dist: bionic - python: 3.6 env: TOXENV=flake8 diff --git a/tests/unittests/config/test_schema.py b/tests/unittests/config/test_schema.py index a6aedf0b840..9ddb2eb0aeb 100644 --- a/tests/unittests/config/test_schema.py +++ b/tests/unittests/config/test_schema.py @@ -1114,6 +1114,7 @@ class TestSchemaFuzz: # Avoid https://github.com/Zac-HD/hypothesis-jsonschema/issues/97 SCHEMA = JsonLocalResolver(get_schema()).resolve() + @pytest.mark.hypothesis_long @skipUnlessHypothesisJsonSchema() @given(from_schema(SCHEMA)) def test_validate_full_schema(self, config): diff --git a/tox.ini b/tox.ini index 37d37b2ccd5..995042b8b08 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,13 @@ [tox] -envlist = py3, lowest-supported-dev, black, flake8, isort, mypy, pylint +envlist = + py3, + lowest-supported-dev, + hypothesis-long, + black, + flake8, + isort, + mypy, + pylint recreate = True [doc8] @@ -97,8 +105,16 @@ deps = -r{toxinidir}/test-requirements.txt commands = {envpython} -m pytest \ --durations 10 \ - {posargs:--cov=cloudinit --cov-branch --hypothesis-show-statistics \ - tests/unittests} + -m "not hypothesis_long" \ + {posargs:--cov=cloudinit --cov-branch tests/unittests} +passenv = HYPOTHESIS_PROFILE + +[testenv:hypothesis-long] +deps = + -r{toxinidir}/test-requirements.txt +commands = {envpython} -m pytest \ + -m hypothesis_long \ + {posargs:--hypothesis-show-statistics tests/unittests} passenv = HYPOTHESIS_PROFILE [lowest-supported-deps] @@ -229,25 +245,26 @@ addopts = --strict log_format = %(asctime)s %(levelname)-9s %(name)s:%(filename)s:%(lineno)d %(message)s log_date_format = %Y-%m-%d %H:%M:%S markers = - allow_subp_for: allow subp usage for the given commands (disable_subp_usage) + adhoc: only run on adhoc basis, not in any CI environment (travis or jenkins) allow_all_subp: allow all subp usage (disable_subp_usage) + allow_subp_for: allow subp usage for the given commands (disable_subp_usage) + azure: test will only run on Azure platform ci: run this integration test as part of CI test runs ds_sys_cfg: a sys_cfg dict to be used by datasource fixtures ec2: test will only run on EC2 platform gce: test will only run on GCE platform - azure: test will only run on Azure platform - oci: test will only run on OCI platform - openstack: test will only run on openstack platform + hypothesis_long: hypothesis test too long to run as unit test + instance_name: the name to be used for the test instance + is_iscsi: whether is an instance has iscsi net cfg or not lxd_config_dict: set the config_dict passed on LXD instance creation lxd_container: test will only run in LXD container lxd_setup: specify callable to be called between init and start lxd_use_exec: `execute` will use `lxc exec` instead of SSH lxd_vm: test will only run in LXD VM - not_bionic: test cannot run on the bionic release no_container: test cannot run in a container - user_data: the user data to be passed to the test instance - instance_name: the name to be used for the test instance + not_bionic: test cannot run on the bionic release + oci: test will only run on OCI platform + openstack: test will only run on openstack platform ubuntu: this test should run on Ubuntu unstable: skip this test because it is flakey - adhoc: only run on adhoc basis, not in any CI environment (travis or jenkins) - is_iscsi: whether is an instance has iscsi net cfg or not + user_data: the user data to be passed to the test instance