Skip to content

Commit

Permalink
Phobos std.socket protocol test
Browse files Browse the repository at this point in the history
  • Loading branch information
atilaneves committed Dec 1, 2019
1 parent 39c5f8e commit d7cabc5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ test: test_python test_cs
test_python: test_python_pyd test_python_pynih
test_python_pyd: test_simple_pyd test_pyd_pyd test_issues_pyd test_numpy_pyd
test_python_pynih: test_simple_pynih test_pyd_pynih test_issues_pynih
test_python_phobos: test_phobos_pynih test_phobos_pyd
test_cs: test_simple_cs

clean:
Expand Down Expand Up @@ -136,7 +137,7 @@ examples/numpy/lib/pynih/libnumpy.so: pynih/source/python/raw.d


test_phobos_pyd: tests/test_phobos.py examples/phobos/lib/pyd/phobos.so
PYTHONPATH=$(PWD)/examples/phobos/lib/pyd pytest -s -vv $<
PYTHONPATH=$(PWD)/examples/phobos/lib/pyd PYD=1 pytest -s -vv $<

examples/phobos/lib/pyd/phobos.so: examples/phobos/lib/pyd/libphobos.so
@cp $^ $@
Expand All @@ -148,7 +149,7 @@ examples/phobos/dub.selections.json:
@cd examples/phobos && dub upgrade -q

test_phobos_pynih: tests/test_phobos.py examples/phobos/lib/pynih/phobos.so
PYTHONPATH=$(PWD)/examples/phobos/lib/pynih pytest -s -vv $<
PYTHONPATH=$(PWD)/examples/phobos/lib/pynih PYNIH=1 pytest -s -vv $<

examples/phobos/lib/pynih/phobos.so: examples/phobos/lib/pynih/libphobos.so
@cp $^ $@
Expand Down
19 changes: 18 additions & 1 deletion tests/test_phobos.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
import os
import pytest

is_pyd = os.environ.get('PYD')
is_pynih = os.environ.get('PYNIH')


def test_protocol():
from phobos import Protocol
if is_pyd:
with pytest.raises(ImportError):
from phobos import Protocol
else:
from phobos import Protocol, ProtocolType

protocol = Protocol()
assert protocol.getProtocolByType(ProtocolType.TCP)

assert protocol.name == "tcp"
assert protocol.aliases == ["TCP"]

0 comments on commit d7cabc5

Please sign in to comment.