Skip to content

[Backport 8.11] Fix CI #2368

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 2 commits into from
Nov 8, 2023
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
27 changes: 3 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,24 @@ jobs:
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x
python-version: "3.11"
- name: Install dependencies
run: |
python3 -m pip install nox
- name: Lint the code
run: nox -s lint

docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
python3 -m pip install nox
- name: Build the docs
run: nox -s docs

test-linux:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
experimental: [false]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
nox-session: [""]
runs-on: ["ubuntu-latest"]
include:
- python-version: 3.11-dev
experimental: true
nox-session: test-3.11
runs-on: "ubuntu-latest"

runs-on: ${{ matrix.runs-on }}
name: test-${{ matrix.python-version }}
continue-on-error: ${{ matrix.experimental }}
continue-on-error: false
steps:
- name: Checkout Repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3"
python: "3.11"

python:
install:
Expand Down
10 changes: 6 additions & 4 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ twine
build
nox

# No wheels for Python 3.10 yet!
numpy; python_version<"3.10"
pandas; python_version<"3.10"
numpy
pandas

# Testing the 'search_mvt' API response
mapbox-vector-tile; python_version<"3.10"
mapbox-vector-tile
# Python 3.7 gets an old version of mapbox-vector-tile, requiring an
# old version of protobuf
protobuf<4; python_version<="3.7"

# Docs
# Override Read the Docs default (sphinx<2 and sphinx-rtd-theme<0.5)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ignore = E203, E266, E501, W503

[tool:pytest]
junit_family=legacy
addopts = -vvv -p no:logging --cov-report=term-missing --cov=elasticsearch --cov-config=.coveragerc
addopts = -vvv --cov-report=term-missing --cov=elasticsearch --cov-config=.coveragerc

[tool:isort]
profile=black
Expand Down
27 changes: 15 additions & 12 deletions test_elasticsearch/test_async/test_server/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.

import asyncio
import logging
from datetime import datetime, timedelta, timezone
from unittest.mock import MagicMock, call, patch

Expand Down Expand Up @@ -619,8 +620,10 @@ async def test_no_scroll_id_fast_route(self, async_client, scan_teardown):
scroll_mock.assert_not_called()
clear_mock.assert_not_called()

@patch("elasticsearch._async.helpers.logger")
async def test_logger(self, logger_mock, async_client, scan_teardown):
async def test_logger(
self, caplog: pytest.LogCaptureFixture, async_client, scan_teardown
):
caplog.set_level(logging.WARNING, logger="elasticsearch.helpers")
bulk = []
for x in range(4):
bulk.append({"index": {"_index": "test_index"}})
Expand All @@ -640,12 +643,16 @@ async def test_logger(self, logger_mock, async_client, scan_teardown):
clear_scroll=False,
)
]
logger_mock.warning.assert_called()

assert caplog.messages == [
"Scroll request has only succeeded on 4 (+0 skipped) shards out of 5."
]

caplog.clear()
with patch.object(
async_client, "options", return_value=async_client
), patch.object(async_client, "scroll", MockScroll()):
try:
with pytest.raises(ScanError):
_ = [
x
async for x in helpers.async_scan(
Expand All @@ -656,14 +663,10 @@ async def test_logger(self, logger_mock, async_client, scan_teardown):
clear_scroll=False,
)
]
except ScanError:
pass
logger_mock.warning.assert_called_with(
"Scroll request has only succeeded on %d (+%d skipped) shards out of %d.",
4,
0,
5,
)

assert caplog.messages == [
"Scroll request has only succeeded on 4 (+0 skipped) shards out of 5."
]

async def test_clear_scroll(self, async_client, scan_teardown):
bulk = []
Expand Down