Skip to content

testudos.pytest_plugin

testudos.pytest_plugin

Pytest plugin: fixtures for Testudos so QA can avoid boilerplate.

Register by installing the package (pip install -e .); pytest discovers the plugin via the pytest11 entry point. Use the fixtures in your test modules:

def test_foo(testudos_client):
# testudos_client: setup_client() already called; engine must be running
btn = wait_for_object("primaryButton")
...
def test_bar(testudos_app):
# testudos_app: session + select_aut + start_app() before test, stop_app() after
btn = wait_for_object("primaryButton")
btn.click()
...

Override the AUT profile name per module by defining the same fixture (required for testudos_app)::

@pytest.fixture(scope="module")
def testudos_aut_name():
return "ExampleTestApp"

Overriding fixtures

All plugin fixtures can be customized using standard pytest fixture overriding: define a fixture with the same name in your test module or in a conftest.py that applies to your tests. Pytest will use your implementation instead of the plugin’s.

Common examples::

conftest.py
import pytest
@pytest.fixture(scope="module")
def testudos_host():
return "127.0.0.1"
@pytest.fixture(scope="module")
def testudos_port():
return 4322
@pytest.fixture(scope="module")
def testudos_aut_name():
# Must match a configured AUT profile in the engine.
return "ExampleTestApp"

If you need different AUTs per directory, place a conftest.py in each test folder and override testudos_aut_name there.

testudos_host

@pytest.fixture(scope="module")
def testudos_host()

Engine host (default localhost). Override in conftest.py to change.

testudos_port

@pytest.fixture(scope="module")
def testudos_port()

Engine port (default 4322). Override in conftest.py to change.

testudos_aut_name

@pytest.fixture(scope="module")
def testudos_aut_name()

AUT profile name in the engine config (must match a registered profile).

You must override this fixture in each test module (or a conftest.py that applies to those tests) when using testudos_app. The default implementation fails on purpose so tests do not silently use a wrong profile.

testudos_client

@pytest.fixture(scope="module")
def testudos_client(testudos_host, testudos_port)

Connect to the engine once per test module.

Skips all tests in the module if the engine is unreachable. Override host/port with fixtures testudos_host and testudos_port if needed.

testudos_app

@pytest.fixture
def testudos_app(testudos_client, testudos_aut_name)

Start the application under test before each test and stop it after.

Depends on testudos_client; use when each test needs a running AUT. Selects the AUT profile testudos_aut_name, then starts the app. Stops any already-running AUT before start so each test gets a fresh process.

testudos_expect_verify

@pytest.fixture(autouse=True)
def testudos_expect_verify()

After each test, raise if any expect.* soft assertion failed.

Clears recorded expect failures before the test so state does not leak.