Skip to content

Commit b1c57b9

Browse files
ramshaw888beniwohli
authored andcommitted
Fix zerorpc tests, move them to separate test env (#581)
zerorpc tests are currently being skipped all of the time because of an incorrect gevent version specified. The line `zerorpc = pytest.importorskip("zerorpc")` actually raises an `ImportError` on it's dependency `gevent`, NOT on `zerorpc` itself.
1 parent aadaba1 commit b1c57b9

File tree

9 files changed

+30
-12
lines changed

9 files changed

+30
-12
lines changed

.ci/.jenkins_exclude.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,16 @@ exclude:
154154
# eventlet
155155
- PYTHON_VERSION: pypy-2 #currently fails on pypy2
156156
FRAMEWORK: eventlet-newest
157+
# zerorpc - only run on py2
158+
- PYTHON_VERSION: pypy-3
159+
FRAMEWORK: zerorpc-0.4
160+
- PYTHON_VERSION: python-3.4
161+
FRAMEWORK: zerorpc-0.4
162+
- PYTHON_VERSION: python-3.5
163+
FRAMEWORK: zerorpc-0.4
164+
- PYTHON_VERSION: python-3.6
165+
FRAMEWORK: zerorpc-0.4
166+
- PYTHON_VERSION: python-3.7
167+
FRAMEWORK: zerorpc-0.4
168+
- PYTHON_VERSION: python-3.8-rc
169+
FRAMEWORK: zerorpc-0.4

.ci/.jenkins_framework.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ FRAMEWORK:
2828
- cassandra-newest
2929
- psutil-newest
3030
- eventlet-newest
31+
- zerorpc-0.4
3132

.ci/.jenkins_framework_full.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ FRAMEWORK:
5959
- elasticsearch-5
6060
- elasticsearch-6
6161
- elasticsearch-7
62+
- zerorpc-0.4

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
### Bugfixes
77
* fixed an issue with http server_url and `'VERIFY_SERVER_CERT': False` (#570, #578)
8+
* fixed zerorpc tests (#581)
89

910
## v5.1.1
1011
[Check the diff](https://github.com/elastic/apm-agent-python/compare/v5.1.0...v5.1.1)

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,14 @@ def get_version():
128128
]
129129

130130
if sys.version_info[0] == 2:
131-
tests_require += ["unittest2", "gevent", "zerorpc>=0.4.0,<0.5", "python-memcached"]
131+
tests_require += ["unittest2", "python-memcached"]
132132
else:
133133
tests_require += ["python3-memcached"]
134134

135135

136136
try:
137137
import __pypy__
138138
except ImportError:
139-
if sys.version_info[0] == 2 and "SKIP_ZERORPC" not in os.environ:
140-
tests_require += ["zerorpc>=0.4.0,<0.5"]
141139
tests_require += ["psycopg2"]
142140

143141
if sys.version_info >= (3, 5):

tests/contrib/zerorpc/zeropc_tests.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@
3636

3737
import pytest
3838

39+
from elasticapm.conf.constants import ERROR
3940
from elasticapm.contrib.zerorpc import Middleware
4041

42+
pytestmark = [
43+
pytest.mark.zerorpc,
44+
pytest.mark.skipif(sys.version_info >= (3, 4), reason="zerorpc>=0.4.0,0.5 not python 3 compatible"),
45+
]
46+
4147
zerorpc = pytest.importorskip("zerorpc")
4248
gevent = pytest.importorskip("gevent")
4349

4450

45-
has_unsupported_pypy = hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (2, 6)
46-
47-
48-
@pytest.mark.skipif(has_unsupported_pypy, reason="Failure with pypy < 2.6")
4951
def test_zerorpc_middleware_with_reqrep(elasticapm_client):
5052
tmpdir = tempfile.mkdtemp()
5153
server_endpoint = "ipc://{0}".format(os.path.join(tmpdir, "random_zeroserver"))
@@ -68,9 +70,9 @@ def test_zerorpc_middleware_with_reqrep(elasticapm_client):
6870
ex = excinfo.value
6971
assert ex.name == "IndexError"
7072
assert len(elasticapm_client.events) == 1
71-
exc = elasticapm_client.events[0]["errors"][0]["exception"]
73+
exc = elasticapm_client.events[ERROR][0]["exception"]
7274
assert exc["type"] == "IndexError"
7375
frames = exc["stacktrace"]
7476
assert frames[0]["function"] == "choice"
7577
assert frames[0]["module"] == "random"
76-
assert elasticapm_client.events[0]["errors"][0]["exception"]["handled"] is False
78+
assert exc["handled"] is False

tests/requirements/requirements-base.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,4 @@ aiohttp ; python_version >= '3.5'
3939
pytest-asyncio ; python_version >= '3.5'
4040
asynctest==0.12.2 ; python_version >= '3.5'
4141

42-
pyzmq==16.0.2 ; python_version == '2.7'
43-
gevent==1.2.2 ; python_version == '2.7'
44-
zerorpc>=0.4.0,<0.5 ; python_version == '2.7'
4542
cachetools==2.0.1 ; python_version == '2.7'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pyzmq==16.0.2 ; python_version == '2.7'
2+
gevent<1.2.0 ; python_version == '2.7'
3+
zerorpc>=0.4.0,<0.5 ; python_version == '2.7'
4+
-r requirements-base.txt

tests/scripts/envs/zerorpc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export PYTEST_MARKER="-m zerorpc"

0 commit comments

Comments
 (0)