diff options
author | James Falcon <james.falcon@canonical.com> | 2022-01-10 16:56:29 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-10 15:56:29 -0700 |
commit | dc1aabfca851e520693c05322f724bd102c76364 (patch) | |
tree | 05c7a0d293b9ddece5671fcdf6a38c59ce776ac8 /doc/rtd/topics/testing.rst | |
parent | 57ccd89b6af7d3551915df56f548b7617dfcebf9 (diff) | |
download | vyos-cloud-init-dc1aabfca851e520693c05322f724bd102c76364.tar.gz vyos-cloud-init-dc1aabfca851e520693c05322f724bd102c76364.zip |
Remove 3.5 and xenial support (SC-711) (#1167)
Includes:
- Update tox.ini and .travis.yml accordingly
- Cleanup tox.ini with new tox syntax and cloud-init dependencies
- Update documentation accordingly
- Replace/remove xenial references where additional testing isn't required
- Remove xenial checks in integration tests
- Replace yield_fixture with fixture in pytest tests
Sections of code commented with lines like "Remove when Xenial is no
longer supported" still exist as they're require additional testing.
Diffstat (limited to 'doc/rtd/topics/testing.rst')
-rw-r--r-- | doc/rtd/topics/testing.rst | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/doc/rtd/topics/testing.rst b/doc/rtd/topics/testing.rst index 7a1e3eec..5543c6f5 100644 --- a/doc/rtd/topics/testing.rst +++ b/doc/rtd/topics/testing.rst @@ -54,28 +54,22 @@ Test Layout * pytest tests should use bare ``assert`` statements, to take advantage of pytest's `assertion introspection`_ - * For ``==`` and other commutative assertions, the expected value - should be placed before the value under test: - ``assert expected_value == function_under_test()`` - - ``pytest`` Version Gotchas -------------------------- -As we still support Ubuntu 16.04 (Xenial Xerus), we can only use pytest -features that are available in v2.8.7. This is an inexhaustive list of +As we still support Ubuntu 18.04 (Bionic Beaver), we can only use pytest +features that are available in v3.3.2. This is an inexhaustive list of ways in which this may catch you out: -* Support for using ``yield`` in ``pytest.fixture`` functions was only - introduced in `pytest 3.0`_. Such functions must instead use the - ``pytest.yield_fixture`` decorator. - * Only the following built-in fixtures are available [#fixture-list]_: * ``cache`` * ``capfd`` - * ``caplog`` (provided by ``python3-pytest-catchlog`` on xenial) + * ``capfdbinary`` + * ``caplog`` * ``capsys`` + * ``capsysbinary`` + * ``doctest_namespace`` * ``monkeypatch`` * ``pytestconfig`` * ``record_xml_property`` @@ -83,22 +77,6 @@ ways in which this may catch you out: * ``tmpdir_factory`` * ``tmpdir`` -* On xenial, the objects returned by the ``tmpdir`` fixture cannot be - used where paths are required; they are rejected as invalid paths. - You must instead use their ``.strpath`` attribute. - - * For example, instead of ``util.write_file(tmpdir.join("some_file"), - ...)``, you should write - ``util.write_file(tmpdir.join("some_file").strpath, ...)``. - -* The `pytest.param`_ function cannot be used. It was introduced in - pytest 3.1, which means it is not available on xenial. The more - limited mechanism it replaced was removed in pytest 4.0, so is not - available in focal or later. The only available alternatives are to - write mark-requiring test instances as completely separate tests, - without utilising parameterisation, or to apply the mark to the - entire parameterized test (and therefore every test instance). - Mocking and Assertions ---------------------- @@ -168,9 +146,9 @@ Test Argument Ordering .. [#fixture-list] This list of fixtures (with markup) can be reproduced by running:: - py.test-3 --fixtures -q | grep "^[^ -]" | grep -v '\(no\|capturelog\)' | sort | sed 's/.*/* ``\0``/' + python3 -m pytest --fixtures -q | grep "^[^ -]" | grep -v 'no tests ran in' | sort | sed 's/ \[session scope\]//g;s/.*/* ``\0``/g' - in a xenial lxd container with python3-pytest-catchlog installed. + in an ubuntu lxd container with python3-pytest installed. .. _pytest: https://docs.pytest.org/ .. _pytest fixtures: https://docs.pytest.org/en/latest/fixture.html |