comparison test/test_dropbear.py @ 1863:b550845e500b

Use venv for test_aslr Otherwise we can't find the psutil dependency
author Matt Johnston <matt@ucc.asn.au>
date Sun, 30 Jan 2022 13:37:20 +0800
parents e0c1825c567d
children 49ce974c3215
comparison
equal deleted inserted replaced
1862:6f265a35159a 1863:b550845e500b
55 else: 55 else:
56 kwargs.setdefault("timeout", 10) 56 kwargs.setdefault("timeout", 10)
57 # wait for response 57 # wait for response
58 return subprocess.run(full_args, **kwargs) 58 return subprocess.run(full_args, **kwargs)
59 59
60 def own_venv_command():
61 """ Returns a command to run as a prefix to get the same venv
62 as the current running Python. Returns '' on not a virtualenv
63 """
64 try:
65 print(os.environ)
66 venv = os.environ['VIRTUAL_ENV']
67 print(venv)
68 except KeyError:
69 return ""
70
71 # note: bash/zsh unix specific
72 return f"source {venv}/bin/activate"
73
60 class HandleTcp(socketserver.ThreadingMixIn, socketserver.TCPServer): 74 class HandleTcp(socketserver.ThreadingMixIn, socketserver.TCPServer):
61 """ Listens for a single incoming request, sends a response if given, 75 """ Listens for a single incoming request, sends a response if given,
62 and returns the inbound data. 76 and returns the inbound data.
63 Reponse can be a queue object, in which case each item in the queue will 77 Reponse can be a queue object, in which case each item in the queue will
64 be sent as a response, until it receives a None item. 78 be sent as a response, until it receives a None item.