Skip to content

Commit

Permalink
Fix Pytest4.x compatibility errors
Browse files Browse the repository at this point in the history
There are no longer named marker attributes:
pytest-dev/pytest#891

This results in not expecting param `ssl` and leads to errors like:
```
...
test/test_dugong.py::test_http_proxy[plain-None] PASSED                  [  4%]
test/test_dugong.py::test_http_proxy[plain-8080] PASSED                  [  5%]
test/test_dugong.py::test_connect_proxy[plain-None] PASSED               [  6%]
test/test_dugong.py::test_connect_proxy[plain-8080] PASSED               [  7%]
...
test/test_dugong.py::test_http_proxy[ssl-None] FAILED                    [ 51%]
test/test_dugong.py::test_http_proxy[ssl-8080] FAILED                    [ 52%]
test/test_dugong.py::test_connect_proxy[ssl-None] FAILED                 [ 53%]
test/test_dugong.py::test_connect_proxy[ssl-8080] FAILED                 [ 54%]
...

So, the marker `no_ssl` is just ignored.
Let's use the `get_closest_marker` method instead.

Signed-off-by: Stanislav Levin <slev@altlinux.org>
  • Loading branch information
stanislavlevin committed May 29, 2019
1 parent 1ca812f commit c7af514
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ formats=bztar
source-dir = rst
build-dir = doc

[tool:pytest]
markers =
no_ssl

2 changes: 1 addition & 1 deletion test/test_dugong.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def pytest_generate_tests(metafunc):
if not 'http_server' in metafunc.fixturenames:
return

if getattr(metafunc.function, 'no_ssl', False):
if metafunc.definition.get_closest_marker('no_ssl'):
params = ('plain',)
else:
params = ('plain', 'ssl')
Expand Down

0 comments on commit c7af514

Please sign in to comment.