Skip to content
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
40 changes: 27 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ concurrency:

jobs:
lint:
name: Lint datadogpy files
name: Lint datadogpy files on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# In the future, we need to add support for Python 2.7 and Python 3.14+
# but for now, those are failing.
python-version: ['3.8']
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Python 3.8
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.8"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install pre-commit
python -m pip install tox

# - name: Run black
Expand All @@ -48,28 +53,37 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04]
python-version: ['pypy2.7', '3.7', 'pypy3.8']
# In the future, we need to add support for Python 2.7 and 3.4, as we officially
# support those versions. However, support for those versions has been removed from
# setup-python so we will need to find a workaround.
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy2.7', 'pypy3.8']
# os: [ubuntu-latest, windows-latest, macos-latest]
# python-version: ['2.7', '3.7', '3.8', '3.9', '3.10', 'pypy-2.7', 'pypy-3.8']
env:
TOXENV: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}

- name: Set constrains for python2.7
- name: Set constraints for python2.7
# Latest PyYaml supported version for python 2.7 is 5.4.1 which requires
# cython<3 to build. See: https://github.com/yaml/pyyaml/issues/724
if: ${{ matrix.python-version == 'pypy2.7' }}
run: |
echo "cython<3" > /tmp/constraints.txt
echo "PIP_CONSTRAINT=/tmp/constraints.txt" >> $GITHUB_ENV

- name: Set TOXENV
run: |
version="${{ matrix.python-version }}"
if [[ "$version" == pypy* ]]; then
echo "TOXENV=$version" >> $GITHUB_ENV
else
echo "TOXENV=py${version//./}" >> $GITHUB_ENV
fi

- name: Install tox
run: pip install tox

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'ci/integrations')
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Python 3.7
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
- name: Set up Python 3.9
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.7"
python-version: "3.9"
cache: "pip"

- name: Install dependencies
Expand Down
6 changes: 6 additions & 0 deletions datadog/api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ def submit(
# Format response content
content = result.content

if content and result.headers.get("Content-Encoding") == "gzip":
try:
content = zlib.decompress(content, zlib.MAX_WBITS | 16)
except zlib.error:
pass

Comment on lines +186 to +191
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if content:
try:
if is_p3k():
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/dogshell/test_dogshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def dogshell(capsys, config_file, dog):
import click
from click.testing import CliRunner

runner = CliRunner(mix_stderr=False)
runner = CliRunner(mix_stderr=False) if sys.version_info[:2] < (3, 10) else CliRunner()

@click.command(context_settings={"ignore_unknown_options": True})
@click.argument('args', nargs=-1, type=click.UNPROCESSED)
Expand Down
11 changes: 7 additions & 4 deletions tests/unit/dogstatsd/test_statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,11 +1029,14 @@ async def print_foo():
time.sleep(0.5)
print("foo")
"""
exec(source, {}, locals())
ns = locals()
exec(source, {}, ns)

loop = asyncio.get_event_loop()
loop.run_until_complete(locals()['print_foo']())
loop.close()
loop = asyncio.new_event_loop()
try:
loop.run_until_complete(ns['print_foo']())
finally:
loop.close()

# Assert
packet = self.recv(2).split("\n")[0] # ignore telemetry packet
Expand Down
Loading