Simple improvements for quality gate (#2517)

* Improvements for quality gate

* Update test_xattr.py

* Update test_mpc_wobble.py

* python

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
pull/2459/head
Jon Ander Oribe 2020-11-12 23:48:45 +01:00 committed by GitHub
parent 7b72bbe9f3
commit 887d67eb8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

View File

@ -6,6 +6,7 @@ import unittest
from common.xattr import getxattr, setxattr, listxattr, removexattr
class TestParams(unittest.TestCase):
USER_TEST='user.test'
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
self.tmpfn = os.path.join(self.tmpdir, 'test.txt')
@ -16,7 +17,7 @@ class TestParams(unittest.TestCase):
shutil.rmtree(self.tmpdir)
def test_getxattr_none(self):
a = getxattr(self.tmpfn, 'user.test')
a = getxattr(self.tmpfn, TestParams.USER_TEST)
assert a is None
def test_listxattr_none(self):
@ -24,8 +25,8 @@ class TestParams(unittest.TestCase):
assert l == []
def test_setxattr(self):
setxattr(self.tmpfn, 'user.test', b'123')
a = getxattr(self.tmpfn, 'user.test')
setxattr(self.tmpfn, TestParams.USER_TEST, b'123')
a = getxattr(self.tmpfn, TestParams.USER_TEST)
assert a == b'123'
def test_listxattr(self):
@ -35,11 +36,11 @@ class TestParams(unittest.TestCase):
assert l == ['user.test1', 'user.test2']
def test_removexattr(self):
setxattr(self.tmpfn, 'user.test', b'123')
a = getxattr(self.tmpfn, 'user.test')
setxattr(self.tmpfn, TestParams.USER_TEST, b'123')
a = getxattr(self.tmpfn, TestParams.USER_TEST)
assert a == b'123'
removexattr(self.tmpfn, 'user.test')
a = getxattr(self.tmpfn, 'user.test')
removexattr(self.tmpfn, TestParams.USER_TEST)
a = getxattr(self.tmpfn, TestParams.USER_TEST)
assert a is None
if __name__ == "__main__":

View File

@ -141,8 +141,7 @@ def fingerprint(logcan, sendcan):
# Toyota needs higher time to fingerprint, since DSU does not broadcast immediately
if only_toyota_left(candidate_cars[b]):
frame_fingerprint = 100 # 1s
if len(candidate_cars[b]) == 1:
if frame > frame_fingerprint:
if len(candidate_cars[b]) == 1 and frame > frame_fingerprint:
# fingerprint done
car_fingerprint = candidate_cars[b][0]

View File

@ -32,7 +32,6 @@ p_l[3] += LANE_WIDTH / 2.0
p_r = p[:]
p_r[3] -= LANE_WIDTH / 2.0
l_poly = libmpc_py.ffi.new("double[4]", p_l)
r_poly = libmpc_py.ffi.new("double[4]", p_r)
p_poly = libmpc_py.ffi.new("double[4]", p)