diff --git a/tests/apps/app_django.py b/tests/apps/app_django.py index 64274ddc4..3c0afd0f4 100755 --- a/tests/apps/app_django.py +++ b/tests/apps/app_django.py @@ -9,8 +9,11 @@ import time import opentracing import opentracing.ext.tags as ext +try: + from django.urls import re_path +except ImportError: + from django.conf.urls import url as re_path -from django.conf.urls import url from django.http import HttpResponse, Http404 filepath, extension = os.path.splitext(__file__) @@ -123,9 +126,9 @@ def complex(request): urlpatterns = [ - url(r'^$', index, name='index'), - url(r'^cause_error$', cause_error, name='cause_error'), - url(r'^another$', another), - url(r'^not_found$', not_found, name='not_found'), - url(r'^complex$', complex, name='complex') + re_path(r'^$', index, name='index'), + re_path(r'^cause_error$', cause_error, name='cause_error'), + re_path(r'^another$', another), + re_path(r'^not_found$', not_found, name='not_found'), + re_path(r'^complex$', complex, name='complex') ] diff --git a/tests/clients/test_pymongo.py b/tests/clients/test_pymongo.py index f205c320c..ca0a7bccf 100644 --- a/tests/clients/test_pymongo.py +++ b/tests/clients/test_pymongo.py @@ -6,6 +6,7 @@ import json import unittest import logging +import pytest from nose.tools import (assert_is_none, assert_is_not_none, assert_false, assert_true, assert_list_equal) @@ -18,6 +19,10 @@ logger = logging.getLogger(__name__) +pymongoversion = pytest.mark.skipif( + pymongo.version_tuple >= (4, 0), reason="map reduce is removed in pymongo 4.0" +) + class TestPyMongoTracer(unittest.TestCase): def setUp(self): @@ -169,6 +174,7 @@ def test_successful_aggregate_query(self): payload = json.loads(db_span.data["mongo"]["json"]) assert_true({"$match": {"type": "string"}} in payload, db_span.data["mongo"]["json"]) + @pymongoversion def test_successful_map_reduce_query(self): mapper = "function () { this.tags.forEach(function(z) { emit(z, 1); }); }" reducer = "function (key, values) { return len(values); }"