Move interop tests out of tests
It is moved to the top level package `tests_interop`, to avoid circular dependency, with the dependency moved to `tox`.
This commit is contained in:
parent
4a838033ff
commit
006002f687
|
@ -18,7 +18,7 @@ matrix:
|
||||||
- export GOPATH=$HOME/go
|
- export GOPATH=$HOME/go
|
||||||
- export GOROOT=/usr/local/go
|
- export GOROOT=/usr/local/go
|
||||||
- export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
|
- export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
|
||||||
- ./tests/interop/go_pkgs/install_interop_go_pkgs.sh
|
- ./tests_interop/go_pkgs/install_interop_go_pkgs.sh
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install --upgrade pip
|
- pip install --upgrade pip
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
FILES_TO_LINT = libp2p tests examples setup.py
|
FILES_TO_LINT = libp2p tests tests_interop examples setup.py
|
||||||
PB = libp2p/crypto/pb/crypto.proto libp2p/pubsub/pb/rpc.proto libp2p/security/insecure/pb/plaintext.proto libp2p/security/secio/pb/spipe.proto
|
PB = libp2p/crypto/pb/crypto.proto libp2p/pubsub/pb/rpc.proto libp2p/security/insecure/pb/plaintext.proto libp2p/security/secio/pb/spipe.proto
|
||||||
PY = $(PB:.proto=_pb2.py)
|
PY = $(PB:.proto=_pb2.py)
|
||||||
PYI = $(PB:.proto=_pb2.pyi)
|
PYI = $(PB:.proto=_pb2.pyi)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -9,8 +9,6 @@ extras_require = {
|
||||||
"pytest>=4.6.3,<5.0.0",
|
"pytest>=4.6.3,<5.0.0",
|
||||||
"pytest-asyncio>=0.10.0,<1.0.0",
|
"pytest-asyncio>=0.10.0,<1.0.0",
|
||||||
"pexpect>=4.6,<5",
|
"pexpect>=4.6,<5",
|
||||||
# FIXME: Master branch. Use PyPI instead after it is released.
|
|
||||||
"p2pclient @ git+https://git@github.com/mhchia/py-libp2p-daemon-bindings@628266f",
|
|
||||||
],
|
],
|
||||||
"lint": [
|
"lint": [
|
||||||
"mypy>=0.701,<1.0",
|
"mypy>=0.701,<1.0",
|
||||||
|
|
|
@ -7,13 +7,46 @@ import pexpect
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from libp2p.io.abc import ReadWriteCloser
|
from libp2p.io.abc import ReadWriteCloser
|
||||||
from tests.factories import FloodsubFactory, GossipsubFactory, PubsubFactory
|
from tests.configs import LISTEN_MADDR
|
||||||
|
from tests.factories import (
|
||||||
|
FloodsubFactory,
|
||||||
|
GossipsubFactory,
|
||||||
|
HostFactory,
|
||||||
|
PubsubFactory,
|
||||||
|
)
|
||||||
from tests.pubsub.configs import GOSSIPSUB_PARAMS
|
from tests.pubsub.configs import GOSSIPSUB_PARAMS
|
||||||
|
|
||||||
from .daemon import Daemon, make_p2pd
|
from .daemon import Daemon, make_p2pd
|
||||||
from .utils import connect
|
from .utils import connect
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def is_host_secure():
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def num_hosts():
|
||||||
|
return 3
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
async def hosts(num_hosts, is_host_secure):
|
||||||
|
_hosts = HostFactory.create_batch(num_hosts, is_secure=is_host_secure)
|
||||||
|
await asyncio.gather(
|
||||||
|
*[_host.get_network().listen(LISTEN_MADDR) for _host in _hosts]
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
yield _hosts
|
||||||
|
finally:
|
||||||
|
# TODO: It's possible that `close` raises exceptions currently,
|
||||||
|
# due to the connection reset things. Though we don't care much about that when
|
||||||
|
# cleaning up the tasks, it is probably better to handle the exceptions properly.
|
||||||
|
await asyncio.gather(
|
||||||
|
*[_host.close() for _host in _hosts], return_exceptions=True
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def proc_factory():
|
def proc_factory():
|
||||||
procs = []
|
procs = []
|
20
tox.ini
20
tox.ini
|
@ -27,11 +27,10 @@ skip_glob=
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
passenv = CI TRAVIS TRAVIS_* GOPATH
|
passenv = CI TRAVIS TRAVIS_*
|
||||||
extras = test
|
extras = test
|
||||||
commands =
|
commands =
|
||||||
test: py.test --ignore=tests/interop
|
test: py.test tests/ -v
|
||||||
interop: py.test tests/interop
|
|
||||||
basepython =
|
basepython =
|
||||||
py37: python3.7
|
py37: python3.7
|
||||||
|
|
||||||
|
@ -40,6 +39,15 @@ basepython = python3
|
||||||
extras = dev
|
extras = dev
|
||||||
commands =
|
commands =
|
||||||
mypy -p libp2p -p examples --config-file {toxinidir}/mypy.ini
|
mypy -p libp2p -p examples --config-file {toxinidir}/mypy.ini
|
||||||
black --check libp2p tests examples setup.py
|
black --check libp2p tests tests_interop examples setup.py
|
||||||
isort --recursive --check-only libp2p tests examples setup.py
|
isort --recursive --check-only libp2p tests tests_interop examples setup.py
|
||||||
flake8 libp2p tests examples setup.py
|
flake8 libp2p tests tests_interop examples setup.py
|
||||||
|
|
||||||
|
[testenv:py37-interop]
|
||||||
|
deps = p2pclient
|
||||||
|
passenv = CI TRAVIS TRAVIS_* GOPATH
|
||||||
|
extras = test
|
||||||
|
commands =
|
||||||
|
test: py.test tests_interop/ -v
|
||||||
|
basepython =
|
||||||
|
py37: python3.7
|
||||||
|
|
Loading…
Reference in New Issue
Block a user