Repository: scoutapp/scout_apm_python
Pull request #659 (2021-06-18 19:38:13)

Support automated tests for python 3.10 RC


Patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index cb36e84..a70e850 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -22,6 +22,7 @@ jobs:
         - 3.7
         - 3.8
         - 3.9
+        - 3.10.0-beta.3
 
     services:
       elasticsearch:
@@ -57,5 +58,5 @@ jobs:
       run: python -m pip install --upgrade tox
     - name: Run tox targets for ${{ matrix.python-version }}
       run: |
-        ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
+        ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}" | cut -c -3)
         TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') python -m tox
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6eb1893..9603c25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,14 +1,16 @@
 # Changelog
 
 ## Pending
-- Improved debug logging for requests. It now includes some summary
-  information about the request.
-  ([Issue #654](https://github.com/scoutapp/scout_apm_python/issues/654))
-- Added Celery's ``priority`` delivery info to the set of tags.
 - Removed parsing queue time from Amazon ALB header, X-Amzn-Trace-Id.
   The time portion of the header only has the truncated seconds which
   appears as about 500ms for queue time constantly.
   ([Issue #631](https://github.com/scoutapp/scout_apm_python/issues/631))
+- Added Celery's ``priority`` delivery info to the set of tags.
+- Changed max spans reached log level from warning to debug.
+  ([Issue #653](https://github.com/scoutapp/scout_apm_python/issues/653))
+- Improved debug logging for requests. It now includes some summary
+  information about the request.
+  ([Issue #654](https://github.com/scoutapp/scout_apm_python/issues/654))
 
 ## [2.19.0] 2021-05-04
 
diff --git a/src/scout_apm/core/tracked_request.py b/src/scout_apm/core/tracked_request.py
index 4fe3a00..55ed674 100644
--- a/src/scout_apm/core/tracked_request.py
+++ b/src/scout_apm/core/tracked_request.py
@@ -91,7 +91,7 @@ class TrackedRequest(object):
 
         if len(self.complete_spans) >= self.MAX_COMPLETE_SPANS:
             if not self.hit_max:
-                logger.warning(
+                logger.debug(
                     "Hit the maximum number of spans, this trace will be incomplete."
                 )
                 self.hit_max = True
diff --git a/tox.ini b/tox.ini
index bbb50f2..e799e7a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,10 +5,10 @@ envlist =
     {py27,py34,py35,py36}-django111
     {py34,py35,py36,py37,py38}-django20
     {py35,py36,py37,py38}-django21
-    {py35,py36,py37,py38,py39}-django22
-    {py36,py37,py38,py39}-django30
-    {py36,py37,py38,py39}-django31
-    {py36,py37,py38,py39}-django32
+    {py35,py36,py37,py38,py39,py310}-django22
+    {py36,py37,py38,py39,py310}-django30
+    {py36,py37,py38,py39,py310}-django31
+    {py36,py37,py38,py39,py310}-django32
 
 [testenv]
 passenv =


Test patch:
diff --git a/pytest.ini b/pytest.ini
index 8ee7bb5..21d01a6 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -61,6 +61,8 @@ filterwarnings =
     ; Triggered by asgiref on Python 3.7+:
     ignore:.*Task.all_tasks\(\) is deprecated, use asyncio.all_tasks\(\) instead.*:PendingDeprecationWarning
     ignore:.*Task.all_tasks\(\) is deprecated, use asyncio.all_tasks\(\) instead.*:DeprecationWarning
+    ; Triggered by asgiref on Python 3.10+:
+    ignore:There is no current event loop.*:DeprecationWarning
     ; cryptography raises a deprecation warning on Python 2
     ignore:Python 2 is no longer supported by the Python core team\..*
     ; cryptography raises a deprecation warning on Python 3.5
@@ -68,3 +70,5 @@ filterwarnings =
     ; Django 3.1 warnings
     ; RemovedInDjango40Warning to be fixed in https://github.com/encode/django-rest-framework/issues/7406
     ignore:django\.conf\.urls\.url\(\) is deprecated.*:PendingDeprecationWarning:rest_framework.routers
+    ; Triggered by Django using Python 3.10+
+    ignore:The distutils package is deprecated and slated for removal in Python 3\.12\. Use setuptools or check PEP 632 for potential alternatives
diff --git a/tests/integration/instruments/test_asyncio_py36plus.py b/tests/integration/instruments/test_asyncio_py36plus.py
index 5a19483..a2ee15e 100644
--- a/tests/integration/instruments/test_asyncio_py36plus.py
+++ b/tests/integration/instruments/test_asyncio_py36plus.py
@@ -19,7 +19,7 @@ def create_task(coro):
     return asyncio.get_event_loop().create_task(coro)
 
 
-async def coro(value=None, wait=None, loop=None):
+async def coro(value=None, wait=None):
     """Helper function for testing coroutines.
 
     :value: This will be inserted into the ``tags`` of ``instrument``.
@@ -29,10 +29,10 @@ async def coro(value=None, wait=None, loop=None):
     """
 
     if wait:
-        await asyncio.sleep(wait, loop=loop)
+        await asyncio.sleep(wait)
     tags = {"value": value} if value else None
     with instrument("coro", tags=tags):
-        await asyncio.sleep(0.1, loop=loop)
+        await asyncio.sleep(0.1)
 
 
 def get_future():
diff --git a/tests/unit/core/test_tracked_request.py b/tests/unit/core/test_tracked_request.py
index c3848a2..31d8f12 100644
--- a/tests/unit/core/test_tracked_request.py
+++ b/tests/unit/core/test_tracked_request.py
@@ -133,7 +133,7 @@ def test_start_span_at_max_ignores_span(caplog, tracked_request):
     assert caplog.record_tuples == [
         (
             "scout_apm.core.tracked_request",
-            logging.WARNING,
+            logging.DEBUG,
             "Hit the maximum number of spans, this trace will be incomplete.",
         )
     ]