Skip to content

Commit 74690fe

Browse files
authored
Move junit XML out of Docker
1 parent 2120dff commit 74690fe

11 files changed

+31
-25
lines changed

.ci/Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
ARG PYTHON_VERSION=3.8
22
FROM python:${PYTHON_VERSION}
33

4-
WORKDIR /code/elasticsearch-py
5-
6-
COPY dev-requirements.txt .
7-
RUN python -m pip install -r dev-requirements.txt
4+
COPY dev-requirements.txt /tmp
5+
RUN python -m pip install -r /tmp/dev-requirements.txt
86

9-
COPY . .
7+
WORKDIR /code/elasticsearch-py

.ci/jobs/defaults.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@
7272
- email:
7373
recipients: infra-root+build@elastic.co
7474
- junit:
75-
results: "*-junit.xml"
75+
results: "junit/*-junit.xml"
7676
allow-empty-results: true

.ci/jobs/elastic+elasticsearch-py+6.x.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name: elastic+elasticsearch-py+6.x
44
display-name: 'elastic / elasticsearch-py # 6.x'
55
description: Testing the elasticsearch-py 6.x branch.
6-
junit_results: "*-junit.xml"
6+
junit_results: "junit/*-junit.xml"
77
parameters:
88
- string:
99
name: branch_specifier

.ci/jobs/elastic+elasticsearch-py+7.x.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name: elastic+elasticsearch-py+7.x
44
display-name: 'elastic / elasticsearch-py # 7.x'
55
description: Testing the elasticsearch-py 7.x branch.
6-
junit_results: "*-junit.xml"
6+
junit_results: "junit/*-junit.xml"
77
parameters:
88
- string:
99
name: branch_specifier

.ci/jobs/elastic+elasticsearch-py+master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name: elastic+elasticsearch-py+master
44
display-name: 'elastic / elasticsearch-py # master'
55
description: Testing the elasticsearch-py master branch.
6-
junit_results: "*-junit.xml"
6+
junit_results: "junit/*-junit.xml"
77
parameters:
88
- string:
99
name: branch_specifier

.ci/jobs/elastic+elasticsearch-py+pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name: elastic+elasticsearch-py+pull-request
44
display-name: 'elastic / elasticsearch-py # pull-request'
55
description: Testing of elasticsearch-py pull requests.
6-
junit_results: "*-junit.xml"
6+
junit_results: "junit/*-junit.xml"
77
scm:
88
- git:
99
branches:

.ci/run-repository.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ docker build \
3131

3232
echo -e "\033[1m>>>>> Run [elastic/elasticsearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
3333

34+
mkdir -p junit
3435
docker run \
3536
--network=${NETWORK_NAME} \
3637
--env "ELASTICSEARCH_HOST=${ELASTICSEARCH_URL}" \
3738
--env "TEST_SUITE=${TEST_SUITE}" \
3839
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
3940
--name elasticsearch-py \
4041
--rm \
42+
--volume `pwd`:/code/elasticsearch-py \
4143
elastic/elasticsearch-py \
4244
python setup.py test

dev-requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
requests>=2, <3
2-
nose
2+
pytest
3+
pytest-cov
34
coverage
45
mock
56
nosexcover

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ requires = python python-urllib3
1111

1212
[flake8]
1313
ignore = E203, E266, E501, W503
14+
15+
[tool:pytest]
16+
junit_family=legacy

test_elasticsearch/run_tests.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
from os.path import dirname, join, pardir, abspath, exists
1111
import subprocess
1212

13-
import nose
14-
1513

1614
def fetch_es_repo():
1715
# user is manually setting YAML dir, don't tamper with it
@@ -70,19 +68,25 @@ def run_all(argv=None):
7068

7169
# always insert coverage when running tests
7270
if argv is None:
71+
junit_xml = join(
72+
abspath(dirname(dirname(__file__))), "junit", "elasticsearch-py-junit.xml"
73+
)
7374
argv = [
74-
"nosetests",
75-
"--with-xunit",
76-
"--with-xcoverage",
77-
"--cover-package=elasticsearch",
78-
"--cover-erase",
79-
"--logging-filter=elasticsearch",
80-
"--logging-level=DEBUG",
81-
"--verbose",
82-
"--with-id",
75+
"pytest",
76+
"--cov=elasticsearch",
77+
"--junitxml=%s" % junit_xml,
78+
"--log-level=DEBUG",
79+
"--cache-clear",
80+
"-vv",
81+
join(abspath(dirname(__file__)), "test_exceptions.py"),
8382
]
8483

85-
nose.run_exit(argv=argv, defaultTest=abspath(dirname(__file__)))
84+
exit_code = 0
85+
try:
86+
subprocess.check_call(argv, stdout=sys.stdout, stderr=sys.stderr)
87+
except subprocess.CalledProcessError as e:
88+
exit_code = e.returncode
89+
sys.exit(exit_code)
8690

8791

8892
if __name__ == "__main__":

0 commit comments

Comments
 (0)