Skip to content

chore(ci): fix test spans being incorrectly marked as failed #13574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import warnings

from _pytest.runner import call_and_report
from _pytest.runner import pytest_runtest_protocol as default_pytest_runtest_protocol
import pytest

import ddtrace
Expand Down Expand Up @@ -415,11 +414,11 @@ def pytest_collection_modifyitems(session, config, items):
@pytest.hookimpl(tryfirst=True)
def pytest_runtest_protocol(item):
if item.get_closest_marker("skip"):
return default_pytest_runtest_protocol(item, None)
return None

skipif = item.get_closest_marker("skipif")
if skipif and skipif.args[0]:
return default_pytest_runtest_protocol(item, None)
return None

marker = item.get_closest_marker("subprocess")
if marker:
Expand Down
3 changes: 2 additions & 1 deletion tests/contrib/django/test_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,8 @@ def test_connection(client, test_spans):
assert span.get_tag("django.db.alias") == "default"

if __name__ == "__main__":
sys.exit(pytest.main(["-x", __file__]))
# --reuse-db needed so the subprocess will not delete the main process database.
sys.exit(pytest.main(["-x", "--reuse-db", __file__]))
""".format(
expected_service_name
)
Expand Down
Loading