Skip to content

Commit 5e8d007

Browse files
[Backport 8.11] Fix CI (#2368)
* Fix CI (#2367) Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
1 parent 7026500 commit 5e8d007

File tree

5 files changed

+26
-42
lines changed

5 files changed

+26
-42
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,24 @@ jobs:
1212
- name: Set up Python 3.x
1313
uses: actions/setup-python@v4
1414
with:
15-
python-version: 3.x
15+
python-version: "3.11"
1616
- name: Install dependencies
1717
run: |
1818
python3 -m pip install nox
1919
- name: Lint the code
2020
run: nox -s lint
2121

22-
docs:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- name: Checkout Repository
26-
uses: actions/checkout@v3
27-
- name: Set up Python 3.x
28-
uses: actions/setup-python@v4
29-
with:
30-
python-version: 3.x
31-
- name: Install dependencies
32-
run: |
33-
python3 -m pip install nox
34-
- name: Build the docs
35-
run: nox -s docs
36-
3722
test-linux:
3823
strategy:
3924
fail-fast: false
4025
matrix:
41-
python-version: ["3.7", "3.8", "3.9", "3.10"]
42-
experimental: [false]
26+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
4327
nox-session: [""]
4428
runs-on: ["ubuntu-latest"]
45-
include:
46-
- python-version: 3.11-dev
47-
experimental: true
48-
nox-session: test-3.11
49-
runs-on: "ubuntu-latest"
5029

5130
runs-on: ${{ matrix.runs-on }}
5231
name: test-${{ matrix.python-version }}
53-
continue-on-error: ${{ matrix.experimental }}
32+
continue-on-error: false
5433
steps:
5534
- name: Checkout Repository
5635
uses: actions/checkout@v3

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3"
6+
python: "3.11"
77

88
python:
99
install:

dev-requirements.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ twine
1515
build
1616
nox
1717

18-
# No wheels for Python 3.10 yet!
19-
numpy; python_version<"3.10"
20-
pandas; python_version<"3.10"
18+
numpy
19+
pandas
2120

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

2527
# Docs
2628
# Override Read the Docs default (sphinx<2 and sphinx-rtd-theme<0.5)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ignore = E203, E266, E501, W503
33

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

88
[tool:isort]
99
profile=black

test_elasticsearch/test_async/test_server/test_helpers.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
import asyncio
19+
import logging
1920
from datetime import datetime, timedelta, timezone
2021
from unittest.mock import MagicMock, call, patch
2122

@@ -619,8 +620,10 @@ async def test_no_scroll_id_fast_route(self, async_client, scan_teardown):
619620
scroll_mock.assert_not_called()
620621
clear_mock.assert_not_called()
621622

622-
@patch("elasticsearch._async.helpers.logger")
623-
async def test_logger(self, logger_mock, async_client, scan_teardown):
623+
async def test_logger(
624+
self, caplog: pytest.LogCaptureFixture, async_client, scan_teardown
625+
):
626+
caplog.set_level(logging.WARNING, logger="elasticsearch.helpers")
624627
bulk = []
625628
for x in range(4):
626629
bulk.append({"index": {"_index": "test_index"}})
@@ -640,12 +643,16 @@ async def test_logger(self, logger_mock, async_client, scan_teardown):
640643
clear_scroll=False,
641644
)
642645
]
643-
logger_mock.warning.assert_called()
644646

647+
assert caplog.messages == [
648+
"Scroll request has only succeeded on 4 (+0 skipped) shards out of 5."
649+
]
650+
651+
caplog.clear()
645652
with patch.object(
646653
async_client, "options", return_value=async_client
647654
), patch.object(async_client, "scroll", MockScroll()):
648-
try:
655+
with pytest.raises(ScanError):
649656
_ = [
650657
x
651658
async for x in helpers.async_scan(
@@ -656,14 +663,10 @@ async def test_logger(self, logger_mock, async_client, scan_teardown):
656663
clear_scroll=False,
657664
)
658665
]
659-
except ScanError:
660-
pass
661-
logger_mock.warning.assert_called_with(
662-
"Scroll request has only succeeded on %d (+%d skipped) shards out of %d.",
663-
4,
664-
0,
665-
5,
666-
)
666+
667+
assert caplog.messages == [
668+
"Scroll request has only succeeded on 4 (+0 skipped) shards out of 5."
669+
]
667670

668671
async def test_clear_scroll(self, async_client, scan_teardown):
669672
bulk = []

0 commit comments

Comments
 (0)