From 28a6e53d4935e2bd62d5aa6d18c119b2c1fd8db0 Mon Sep 17 00:00:00 2001 From: Junzi Sun Date: Fri, 23 Aug 2019 14:59:50 +0200 Subject: [PATCH] update dependencies --- README.rst | 4 +++- pyModeS/extra/tcpclient.py | 8 +++---- setup.py | 2 +- tests/test_adsb.py | 48 ++++++++++++++++++++++++-------------- tox.ini | 2 ++ 5 files changed, 39 insertions(+), 25 deletions(-) diff --git a/README.rst b/README.rst index 91b9ff1..c1eda9f 100644 --- a/README.rst +++ b/README.rst @@ -72,13 +72,15 @@ To install the latest version development from the GitHub: pip install git+https://github.com/junzis/pyModeS -To install the stable version (2.0) from pip: +To install the latest stable version from pip: :: pip install pyModeS +The library requires several dependencies (``numpy``, ``pyzmq``, ``pyrtlsdr``), which will be installed automatically when you install pyModeS using ``pip``. + View live traffic (modeslive) ---------------------------------------------------- diff --git a/pyModeS/extra/tcpclient.py b/pyModeS/extra/tcpclient.py index 784176e..0b856da 100644 --- a/pyModeS/extra/tcpclient.py +++ b/pyModeS/extra/tcpclient.py @@ -1,10 +1,8 @@ -""" -Stream beast raw data from a TCP server, convert to mode-s messages -""" +"""Stream beast raw data from a TCP server, convert to mode-s messages.""" + from __future__ import print_function, division import os import sys -import socket import time import pyModeS as pms from threading import Thread @@ -32,7 +30,7 @@ class BaseClient(Thread): def connect(self): self.socket = zmq.Context().socket(zmq.STREAM) self.socket.setsockopt(zmq.LINGER, 0) - self.socket.setsockopt(zmq.RCVTIMEO, 2000) + self.socket.setsockopt(zmq.RCVTIMEO, 10000) self.socket.connect("tcp://%s:%s" % (self.host, self.port)) def read_raw_buffer(self): diff --git a/setup.py b/setup.py index 4cd5f8e..7b80193 100644 --- a/setup.py +++ b/setup.py @@ -74,7 +74,7 @@ setup( # your project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/requirements.html - install_requires=["numpy", "argparse"], + install_requires=["numpy", "argparse", "pyzmq", "pyrtlsdr"], # List additional groups of dependencies here (e.g. development # dependencies). You can install these using the following syntax, # for example: diff --git a/tests/test_adsb.py b/tests/test_adsb.py index e4b14d6..58e5015 100644 --- a/tests/test_adsb.py +++ b/tests/test_adsb.py @@ -2,12 +2,13 @@ from pyModeS import adsb # === TEST ADS-B package === + def test_adsb_icao(): assert adsb.icao("8D406B902015A678D4D220AA4BDA") == "406B90" def test_adsb_category(): - assert adsb.category("8D406B902015A678D4D220AA4BDA") == 5 + assert adsb.category("8D406B902015A678D4D220AA4BDA") == 0 def test_adsb_callsign(): @@ -15,9 +16,12 @@ def test_adsb_callsign(): def test_adsb_position(): - pos = adsb.position("8D40058B58C901375147EFD09357", - "8D40058B58C904A87F402D3B8C59", - 1446332400, 1446332405) + pos = adsb.position( + "8D40058B58C901375147EFD09357", + "8D40058B58C904A87F402D3B8C59", + 1446332400, + 1446332405, + ) assert pos == (49.81755, 6.08442) @@ -29,27 +33,35 @@ def test_adsb_position_with_ref(): def test_adsb_airborne_position_with_ref(): - pos = adsb.airborne_position_with_ref("8D40058B58C901375147EFD09357", - 49.0, 6.0) + pos = adsb.airborne_position_with_ref( + "8D40058B58C901375147EFD09357", 49.0, 6.0 + ) assert pos == (49.82410, 6.06785) - pos = adsb.airborne_position_with_ref("8D40058B58C904A87F402D3B8C59", - 49.0, 6.0) + pos = adsb.airborne_position_with_ref( + "8D40058B58C904A87F402D3B8C59", 49.0, 6.0 + ) assert pos == (49.81755, 6.08442) def test_adsb_surface_position_with_ref(): - pos = adsb.surface_position_with_ref("8FC8200A3AB8F5F893096B000000", - -43.5, 172.5) + pos = adsb.surface_position_with_ref( + "8FC8200A3AB8F5F893096B000000", -43.5, 172.5 + ) assert pos == (-43.48564, 172.53942) def test_adsb_surface_position(): - pos = adsb.surface_position("8CC8200A3AC8F009BCDEF2000000", - "8FC8200A3AB8F5F893096B000000", - 0, 2, - -43.496, 172.558) + pos = adsb.surface_position( + "8CC8200A3AC8F009BCDEF2000000", + "8FC8200A3AB8F5F893096B000000", + 0, + 2, + -43.496, + 172.558, + ) assert pos == (-43.48564, 172.53942) + def test_adsb_alt(): assert adsb.altitude("8D40058B58C901375147EFD09357") == 39000 @@ -58,10 +70,10 @@ def test_adsb_velocity(): vgs = adsb.velocity("8D485020994409940838175B284F") vas = adsb.velocity("8DA05F219B06B6AF189400CBC33F") vgs_surface = adsb.velocity("8FC8200A3AB8F5F893096B000000") - assert vgs == (159, 182.88, -832, 'GS') - assert vas == (375, 243.98, -2304, 'TAS') - assert vgs_surface == (19.0, 42.2, 0 , 'GS') - assert adsb.altitude_diff('8D485020994409940838175B284F') == 550 + assert vgs == (159, 182.88, -832, "GS") + assert vas == (375, 243.98, -2304, "TAS") + assert vgs_surface == (19.0, 42.2, 0, "GS") + assert adsb.altitude_diff("8D485020994409940838175B284F") == 550 # def test_nic(): diff --git a/tox.ini b/tox.ini index 66cae0a..9a0ca74 100644 --- a/tox.ini +++ b/tox.ini @@ -6,4 +6,6 @@ envlist = py2,py3 deps = pytest numpy + pyzmq + pyrtlsdr commands = py.test