Skip to content

Commit 2c782b9

Browse files
committed
CI fixes
1 parent 0187c89 commit 2c782b9

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
check_lint: ['0']
2626
extra_name: ['']
2727
include:
28-
- python: '2.7'
29-
extra_name: ', build only'
3028
- python: '3.9'
3129
check_lint: '1'
3230
extra_name: ', check lint'

ci.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ python setup.py sdist --formats=zip
1313
pip uninstall -y cython
1414
pip install dist/*.zip
1515

16-
if python --version 2>&1 | fgrep -q "Python 2.7"; then
17-
# The testsuite doesn't run on 2.7, so do just a basic smoke test.
18-
unshare -Urn python -c "from netfilterqueue import NetfilterQueue as NFQ; NFQ()"
19-
exit $?
20-
fi
21-
2216
pip install -Ur test-requirements.txt
2317

2418
if [ "$CHECK_LINT" = "1" ]; then

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
# We're being run by pip to figure out what we need. Request cython in
2121
# setup_requires below.
2222
setup_requires = ["cython"]
23-
elif not os.path.exists(os.path.join(os.path.dirname(__file__), "netfilterqueue.c")):
23+
elif not os.path.exists(
24+
os.path.join(os.path.dirname(__file__), "netfilterqueue.c")
25+
):
2426
sys.stderr.write(
2527
"You must have Cython installed (`pip install cython`) to build this "
2628
"package from source.\nIf you're receiving this error when installing from "
@@ -35,6 +37,7 @@
3537
setup(
3638
ext_modules=ext_modules,
3739
setup_requires=setup_requires,
40+
python_requires=">=3.6",
3841
name="NetfilterQueue",
3942
version=VERSION,
4043
license="MIT",

tests/test_basic.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,15 @@ async def test_errors(harness):
103103

104104
async def test_unretained(harness):
105105
# Capture packets without retaining -> can't access payload
106-
async with harness.capture_packets_to(2, trio.MemorySendChannel.send_nowait) as chan:
106+
async with harness.capture_packets_to(
107+
2, trio.MemorySendChannel.send_nowait
108+
) as chan:
107109
await harness.send(2, b"one", b"two")
108110
accept = True
109111
async for p in chan:
110-
with pytest.raises(RuntimeError, match="Payload data is no longer available"):
112+
with pytest.raises(
113+
RuntimeError, match="Payload data is no longer available"
114+
):
111115
p.get_payload()
112116
# Can still issue verdicts though
113117
if accept:
@@ -166,7 +170,7 @@ def cb(channel, p):
166170

167171
@contextmanager
168172
def catch_unraisable_exception():
169-
pass
173+
yield
170174

171175
with catch_unraisable_exception() as unraise, trio.CancelScope() as cscope:
172176
async with harness.capture_packets_to(2, cb):
@@ -188,7 +192,9 @@ def catch_unraisable_exception():
188192
assert str(unraise.unraisable.exc_value) == "test"
189193

190194
if not unraise:
191-
assert "Exception ignored in: 'netfilterqueue callback" in capsys.readouterr().err
195+
assert (
196+
"Exception ignored in: 'netfilterqueue callback" in capsys.readouterr().err
197+
)
192198

193199
with pytest.raises(RuntimeError, match="Payload data is no longer available"):
194200
pkt.get_payload()

0 commit comments

Comments
 (0)