mirror of
https://github.com/meshtastic/python.git
synced 2026-01-08 15:57:57 -05:00
revert --test change; move tunnel import back; add encoding info to support
This commit is contained in:
@@ -16,7 +16,6 @@ from .tcp_interface import TCPInterface
|
||||
from .ble_interface import BLEInterface
|
||||
from . import test, remote_hardware
|
||||
from . import portnums_pb2, channel_pb2, mesh_pb2, radioconfig_pb2
|
||||
from . import tunnel
|
||||
from .util import support_info, our_exit, genPSK256, fromPSK, fromStr
|
||||
from .globals import Globals
|
||||
|
||||
@@ -473,6 +472,8 @@ def onConnected(interface):
|
||||
print(qr.terminal())
|
||||
|
||||
if have_tunnel and args.tunnel:
|
||||
# pylint: disable=C0415
|
||||
from . import tunnel
|
||||
# Even if others said we could close, stay open if the user asked for a tunnel
|
||||
closeNow = False
|
||||
tunnel.Tunnel(interface, subnet=args.tunnel_net)
|
||||
@@ -511,12 +512,11 @@ def common():
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit(1)
|
||||
our_exit("", 1)
|
||||
else:
|
||||
if args.support:
|
||||
print("")
|
||||
support_info()
|
||||
sys.exit(0)
|
||||
our_exit("", 0)
|
||||
|
||||
if args.ch_index is not None:
|
||||
channelIndex = int(args.ch_index)
|
||||
@@ -540,10 +540,9 @@ def common():
|
||||
logging.error(
|
||||
'This option has been deprecated, see help below for the correct replacement...')
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit(1)
|
||||
elif args.numTests:
|
||||
numTests = int(args.numTests[0])
|
||||
result = test.testAll(numTests)
|
||||
our_exit('', 1)
|
||||
elif args.test:
|
||||
result = test.testAll()
|
||||
if not result:
|
||||
our_exit("Warning: Test was not successful.")
|
||||
else:
|
||||
@@ -720,7 +719,7 @@ def initParser():
|
||||
action="store_true")
|
||||
|
||||
parser.add_argument("--test", help="Run stress test against all connected Meshtastic devices",
|
||||
nargs=1, dest='numTests', action="store")
|
||||
action="store_true")
|
||||
|
||||
parser.add_argument("--ble", help="BLE mac address to connect to (BLE is not yet supported for this tool)",
|
||||
default=None)
|
||||
|
||||
@@ -140,7 +140,7 @@ def openDebugLog(portName):
|
||||
return open(debugname, 'w+', buffering=1, encoding='utf8')
|
||||
|
||||
|
||||
def testAll(numTests=50):
|
||||
def testAll(numTests=5):
|
||||
"""
|
||||
Run a series of tests using devices we can find.
|
||||
This is called from the cli with the "--test" option.
|
||||
|
||||
@@ -16,7 +16,7 @@ def test_smoke2_info():
|
||||
@pytest.mark.smoke2
|
||||
def test_smoke2_test():
|
||||
"""Test --test"""
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --test 5')
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --test')
|
||||
assert re.search(r'Writing serial debugging', out, re.MULTILINE)
|
||||
assert re.search(r'Ports opened', out, re.MULTILINE)
|
||||
assert re.search(r'Running 5 tests', out, re.MULTILINE)
|
||||
|
||||
@@ -175,6 +175,7 @@ def our_exit(message, return_value = 1):
|
||||
|
||||
def support_info():
|
||||
"""Print out info that is helping in support of the cli."""
|
||||
print('')
|
||||
print('If having issues with meshtastic cli or python library')
|
||||
print('or wish to make feature requests, visit:')
|
||||
print('https://github.com/meshtastic/Meshtastic-python/issues')
|
||||
@@ -183,10 +184,11 @@ def support_info():
|
||||
print(' Platform: {0}'.format(platform.platform()))
|
||||
print(' Release: {0}'.format(platform.uname().release))
|
||||
print(' Machine: {0}'.format(platform.uname().machine))
|
||||
print(' Encoding (stdin): {0}'.format(sys.stdin.encoding))
|
||||
print(' Encoding (stdout): {0}'.format(sys.stdout.encoding))
|
||||
print(' meshtastic: v{0}'.format(pkg_resources.require('meshtastic')[0].version))
|
||||
print(' Executable: {0}'.format(sys.argv[0]))
|
||||
print(' Python: {0} {1} {2}'.format(platform.python_version(),
|
||||
platform.python_implementation(), platform.python_compiler()))
|
||||
print('')
|
||||
print('Please add the output from the command: meshtastic --info')
|
||||
print('')
|
||||
|
||||
Reference in New Issue
Block a user