summaryrefslogtreecommitdiff
path: root/doc/rtd
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2022-01-10 16:56:29 -0600
committerGitHub <noreply@github.com>2022-01-10 15:56:29 -0700
commitdc1aabfca851e520693c05322f724bd102c76364 (patch)
tree05c7a0d293b9ddece5671fcdf6a38c59ce776ac8 /doc/rtd
parent57ccd89b6af7d3551915df56f548b7617dfcebf9 (diff)
downloadvyos-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')
-rw-r--r--doc/rtd/topics/debugging.rst6
-rw-r--r--doc/rtd/topics/testing.rst38
2 files changed, 11 insertions, 33 deletions
diff --git a/doc/rtd/topics/debugging.rst b/doc/rtd/topics/debugging.rst
index b897a318..a4a2779f 100644
--- a/doc/rtd/topics/debugging.rst
+++ b/doc/rtd/topics/debugging.rst
@@ -88,7 +88,7 @@ To quickly obtain a cloud-init log try using lxc on any ubuntu system:
.. code-block:: shell-session
- $ lxc init ubuntu-daily:xenial x1
+ $ lxc init ubuntu-daily:focal x1
$ lxc start x1
$ # Take lxc's cloud-init.log and pipe it to the analyzer
$ lxc file pull x1/var/log/cloud-init.log - | cloud-init analyze dump -i -
@@ -104,13 +104,13 @@ To quickly analyze a KVM a cloud-init log:
.. code-block:: shell-session
- $ wget https://cloud-images.ubuntu.com/daily/server/xenial/current/xenial-server-cloudimg-amd64.img
+ $ wget https://cloud-images.ubuntu.com/daily/server/focal/current/focal-server-cloudimg-amd64.img
2. Create a snapshot image to preserve the original cloud-image
.. code-block:: shell-session
- $ qemu-img create -b xenial-server-cloudimg-amd64.img -f qcow2 \
+ $ qemu-img create -b focal-server-cloudimg-amd64.img -f qcow2 \
test-cloudinit.qcow2
3. Create a seed image with metadata using `cloud-localds`
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