diff --git a/resources/scripts/pytest_otel/Makefile b/resources/scripts/pytest_otel/Makefile index 194e1139a..1af560b6d 100644 --- a/resources/scripts/pytest_otel/Makefile +++ b/resources/scripts/pytest_otel/Makefile @@ -136,14 +136,15 @@ publish: package ## @help:demo-start-DEMO_NAME:Starts the demo from the demo folder, DEMO_NAME is the name of the demo type folder in the docs/demos folder (jaeger, elastic). .PHONY: demo-start-% -demo-start-%: +demo-start-%: virtualenv install $(MAKE) demo-stop-$* mkdir -p $(DEMO_DIR)/$*/build touch $(DEMO_DIR)/$*/build/tests.json docker-compose -f $(DEMO_DIR)/$*/docker-compose.yml up -d . $(DEMO_DIR)/$*/demo.env;\ env | grep OTEL;\ - $(MAKE) test + source $(VENV)/bin/activate;\ + pytest --capture=no docs/demos/test/test_demo.py || echo "Demo execution finished you can access to http://localhost:5601 to check the traces"; ## @help:demo-stop-DEMO_NAME:Stops the demo from the demo folder, DEMO_NAME is the name of the demo type folder in the docs/demos folder (jaeger, elastic). .PHONY: demo-stop-% diff --git a/resources/scripts/pytest_otel/docs/demos/test/test_demo.py b/resources/scripts/pytest_otel/docs/demos/test/test_demo.py new file mode 100644 index 000000000..7d04e5335 --- /dev/null +++ b/resources/scripts/pytest_otel/docs/demos/test/test_demo.py @@ -0,0 +1,35 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +pytest_plugins = ["pytester"] + +import time +import logging +import pytest + + +def test_basic(): + time.sleep(5) + pass + +def test_success(): + assert True + +def test_failure(): + assert 1 < 0 + +def test_failure_code(): + d = 1/0 + pass + +@pytest.mark.skip +def test_skip(): + assert True + +@pytest.mark.xfail(reason="foo bug") +def test_xfail(): + assert False + +@pytest.mark.xfail(run=False) +def test_xfail_no_run(): + assert False