nixpkgs/pkgs/development/python-modules/snitun/default.nix
Martin Weinelt 7644480555
python3Packages.snitun: disable failing test on darwin (#119009)
The upstream advertises this package as "OS independent", but from
issues it is clear they cannot test it on MacOS. So we simply disable
this test.

```
______________________ test_peer_listener_timeout[pyloop] ______________________

raise_timeout = None
peer_manager = <snitun.server.peer_manager.PeerManager object at 0x10a4a6df0>
peer_listener = <snitun.server.listener_peer.PeerListener object at 0x10a4a6a30>
test_client_peer = Client(reader=<StreamReader exception=ConnectionResetError(54, 'Connection reset by peer') transport=<_SelectorSocketT...by peer') transport=<_SelectorSocketTransport closed fd=19>>>, close=<asyncio.locks.Event object at 0x10909ee50 [set]>)

    async def test_peer_listener_timeout(
        raise_timeout, peer_manager, peer_listener, test_client_peer
    ):
        """Run a full flow of with a peer."""
        valid = datetime.utcnow() + timedelta(days=1)
        aes_key = os.urandom(32)
        aes_iv = os.urandom(16)
        hostname = "localhost"
        fernet_token = create_peer_config(valid.timestamp(), hostname, aes_key, aes_iv)

        crypto = CryptoTransport(aes_key, aes_iv)

        test_client_peer.writer.write(fernet_token)
        await test_client_peer.writer.drain()

        with pytest.raises(asyncio.IncompleteReadError):
>           token = await test_client_peer.reader.readexactly(32)

tests/server/test_listener_peer.py:110:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/dpa7p7v00xvr26dv2myh3k5p1zkagqsm-python3-3.8.5/lib/python3.8/asyncio/streams.py:723: in readexactly
    await self._wait_for_data('readexactly')
/nix/store/dpa7p7v00xvr26dv2myh3k5p1zkagqsm-python3-3.8.5/lib/python3.8/asyncio/streams.py:517: in _wait_for_data
    await self._waiter
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_SelectorSocketTransport closed fd=19>

    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 54] Connection reset by peer
```
2021-04-11 02:18:59 -04:00

36 lines
1.0 KiB
Nix

{ lib, stdenv, buildPythonPackage, python, fetchFromGitHub
, attrs, cryptography, async-timeout, pytest-aiohttp, pytestCheckHook
}:
buildPythonPackage rec {
pname = "snitun";
version = "0.20";
src = fetchFromGitHub {
owner = "NabuCasa";
repo = pname;
rev = version;
sha256 = "1nscfwycclfbll709w1q46w6rl0r5c3b85rsc7zwc3ixd1k8aajp";
};
propagatedBuildInputs = [ attrs cryptography async-timeout ];
checkInputs = [ pytestCheckHook pytest-aiohttp ];
disabledTests = lib.optionals stdenv.isDarwin [
"test_multiplexer_data_channel_abort_full" # https://github.com/NabuCasa/snitun/issues/61
# port binding conflicts
"test_snitun_single_runner_timeout"
"test_snitun_single_runner_throttling"
# ConnectionResetError: [Errno 54] Connection reset by peer
"test_peer_listener_timeout"
];
meta = with lib; {
homepage = "https://github.com/nabucasa/snitun";
description = "SNI proxy with TCP multiplexer";
license = licenses.gpl3;
maintainers = with maintainers; [ Scriptkiddi ];
};
}