diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42a6f1c..6c0ce29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,6 @@ jobs: check_lint: ['0'] extra_name: [''] include: - - python: '2.7' - extra_name: ', build only' - python: '3.9' check_lint: '1' extra_name: ', check lint' diff --git a/ci.sh b/ci.sh index 0284cdc..d836d17 100755 --- a/ci.sh +++ b/ci.sh @@ -13,12 +13,6 @@ python setup.py sdist --formats=zip pip uninstall -y cython pip install dist/*.zip -if python --version 2>&1 | fgrep -q "Python 2.7"; then - # The testsuite doesn't run on 2.7, so do just a basic smoke test. - unshare -Urn python -c "from netfilterqueue import NetfilterQueue as NFQ; NFQ()" - exit $? -fi - pip install -Ur test-requirements.txt if [ "$CHECK_LINT" = "1" ]; then diff --git a/setup.py b/setup.py index 33d23f7..eca1bab 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,9 @@ except ImportError: # We're being run by pip to figure out what we need. Request cython in # setup_requires below. setup_requires = ["cython"] - elif not os.path.exists(os.path.join(os.path.dirname(__file__), "netfilterqueue.c")): + elif not os.path.exists( + os.path.join(os.path.dirname(__file__), "netfilterqueue.c") + ): sys.stderr.write( "You must have Cython installed (`pip install cython`) to build this " "package from source.\nIf you're receiving this error when installing from " @@ -35,6 +37,7 @@ except ImportError: setup( ext_modules=ext_modules, setup_requires=setup_requires, + python_requires=">=3.6", name="NetfilterQueue", version=VERSION, license="MIT", diff --git a/tests/test_basic.py b/tests/test_basic.py index 6998afe..ff71479 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -103,11 +103,15 @@ async def test_errors(harness): async def test_unretained(harness): # Capture packets without retaining -> can't access payload - async with harness.capture_packets_to(2, trio.MemorySendChannel.send_nowait) as chan: + async with harness.capture_packets_to( + 2, trio.MemorySendChannel.send_nowait + ) as chan: await harness.send(2, b"one", b"two") accept = True async for p in chan: - with pytest.raises(RuntimeError, match="Payload data is no longer available"): + with pytest.raises( + RuntimeError, match="Payload data is no longer available" + ): p.get_payload() # Can still issue verdicts though if accept: @@ -166,7 +170,7 @@ async def test_cb_exception_during_unbind(harness, capsys): @contextmanager def catch_unraisable_exception(): - pass + yield with catch_unraisable_exception() as unraise, trio.CancelScope() as cscope: async with harness.capture_packets_to(2, cb): @@ -188,7 +192,9 @@ async def test_cb_exception_during_unbind(harness, capsys): assert str(unraise.unraisable.exc_value) == "test" if not unraise: - assert "Exception ignored in: 'netfilterqueue callback" in capsys.readouterr().err + assert ( + "Exception ignored in: 'netfilterqueue callback" in capsys.readouterr().err + ) with pytest.raises(RuntimeError, match="Payload data is no longer available"): pkt.get_payload()