diff --git a/common/tests/test_xattr.py b/common/tests/test_xattr.py index d8f0197d36..16f6d52977 100644 --- a/common/tests/test_xattr.py +++ b/common/tests/test_xattr.py @@ -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__": diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 14dbbb889d..2af6df269e 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -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] diff --git a/selfdrive/debug/mpc/test_mpc_wobble.py b/selfdrive/debug/mpc/test_mpc_wobble.py index 6117779d8b..5f551ebd0a 100755 --- a/selfdrive/debug/mpc/test_mpc_wobble.py +++ b/selfdrive/debug/mpc/test_mpc_wobble.py @@ -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)