dash-testing-stub Library

0.0.2 · active · verified Fri Apr 17

dash-testing-stub is a lightweight Python package, currently at version 0.0.2. Its sole purpose is to serve as a marker or stub dependency within the `dash[testing]` extra, signaling the availability for optional loading of the `pytest-dash` plugin. It is not intended for direct user import or interaction, acting purely as an internal mechanism for conditional feature enablement in Dash testing environments. It is released as part of the official Dash framework.

Common errors

Warnings

Install

Imports

Quickstart

To 'use' `dash-testing-stub`, you typically install `dash[testing]`, which includes it. Then, you can write pytest tests for your Dash applications using the `dash_duo` fixture provided by the `pytest-dash` plugin. The stub package itself has no API to call.

# 1. Install Dash with testing extras:
# pip install dash[testing]

# 2. Create a test file (e.g., test_app.py):
import dash
from dash import html
import pytest

@pytest.fixture
def dash_app():
    app = dash.Dash(__name__)
    app.layout = html.Div([html.H1("Hello Dash Testing!"), html.Div(id='output-div')])
    return app

def test_initial_layout(dash_duo, dash_app):
    dash_duo.start_server(dash_app)
    dash_duo.wait_for_text_to_equal("h1", "Hello Dash Testing!", timeout=4)
    assert dash_duo.driver.find_element_by_tag_name("h1").text == "Hello Dash Testing!"

# 3. Run pytest from your terminal in the same directory:
# pytest

view raw JSON →