From fff1fab292ade52271b40b3dbdad5fc591bd803f Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 5 Aug 2016 14:09:24 +0200 Subject: [PATCH] Test the path lint. --- lint/tests/test_path_lints.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lint/tests/test_path_lints.py diff --git a/lint/tests/test_path_lints.py b/lint/tests/test_path_lints.py new file mode 100644 index 00000000000000..83cb8aaa6341ec --- /dev/null +++ b/lint/tests/test_path_lints.py @@ -0,0 +1,25 @@ +from __future__ import unicode_literals + +from ..lint import check_path +import pytest +import six + +def test_allowed_path_length(): + basename = 29 * "test/" + + for idx in range(5): + filename = basename + idx * "a" + + errors = check_path("/foo/", filename) + assert errors == [] + + +def test_forbidden_path_length(): + basename = 29 * "test/" + + for idx in range(5, 10): + filename = basename + idx * "a" + message = "/%s longer than maximum path length (%s > 150)" % (filename, 146 + idx) + + errors = check_path("/foo/", filename) + assert errors == [("PATH LENGTH", message, None)]