commit:     273644d1ee78da50473c7677850eee117ce0983e
Author:     David Palao <david.palao <AT> gmail <DOT> com>
AuthorDate: Fri Jul  7 15:32:10 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 30 03:14:23 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=273644d1

tests/emerge: test_simple.py, conftest.py: Add docstrings

Add docstrings. They contain some brief documentation about the tests,
the fixture with the commands and how to select those tests with pytest.

Also the main test function was renamed:

test_simple_emerge -> test_portage_baseline

Signed-off-by: David Palao <david.palao <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/tests/emerge/conftest.py    |  6 ++++++
 lib/portage/tests/emerge/test_simple.py | 20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/lib/portage/tests/emerge/conftest.py 
b/lib/portage/tests/emerge/conftest.py
index 9cb4691f56..656ee85726 100644
--- a/lib/portage/tests/emerge/conftest.py
+++ b/lib/portage/tests/emerge/conftest.py
@@ -388,6 +388,12 @@ def binhost(playground, async_loop):
 
 @pytest.fixture()
 def simple_command(playground, binhost, request):
+    """A fixture that provides the commands to perform a baseline
+    functional test of portage.
+
+    To add a new command, define it in the local ``test_commands`` and
+    add its key to the ``_SIMPLE_COMMAND_SEQUENCE``.
+    """
     settings = playground.settings
     eprefix = settings["EPREFIX"]
     eroot = settings["EROOT"]

diff --git a/lib/portage/tests/emerge/test_simple.py 
b/lib/portage/tests/emerge/test_simple.py
index 12a16f2d93..b13add9122 100644
--- a/lib/portage/tests/emerge/test_simple.py
+++ b/lib/portage/tests/emerge/test_simple.py
@@ -1,6 +1,24 @@
 # Copyright 2011-2021, 2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+"""This module defines a baseline for portage's functionality.
+
+Multiple portage commands are executed in a sequence in a playground
+(see the ``simple_command`` fixture in ``conftest.py``).
+
+All the commands are triggered from the ``test_portage_baseline`` test.
+That test is marked with::
+
+  @pytest.mark.ft
+
+so that it can selected with that marker, i.e.::
+
+  pytest -m ft
+
+``ft`` stands for *functional test*, since that's what it is, a
+functional or end-to-end test.
+"""
+
 import subprocess
 
 import pytest
@@ -39,7 +57,7 @@ move dev-util/git dev-vcs/git
 
 
 @pytest.mark.ft
-def test_simple_emerge(async_loop, playground, binhost, simple_command):
+def test_portage_baseline(async_loop, playground, binhost, simple_command):
     async_loop.run_until_complete(
         asyncio.ensure_future(
             _async_test_simple(

Reply via email to