@@ -56,68 +56,6 @@ function get_python_files {
5656 ! -name ' *~' \) `
5757}
5858
59- function licence_check {
60- # Iterate through files to check whether they contain the expected
61- # licence information. If any files do not contain the expected licence
62- # information, then this test will fail.
63- read -d ' ' expected << '__TEXT__ ' || true
64- # -*- coding: utf-8 -*-
65- # -----------------------------------------------------------------------------
66- # (C) British Crown Copyright 2017-2021 Met Office.
67- # All rights reserved.
68- #
69- # Redistribution and use in source and binary forms, with or without
70- # modification, are permitted provided that the following conditions are met:
71- #
72- # * Redistributions of source code must retain the above copyright notice, this
73- # list of conditions and the following disclaimer.
74- #
75- # * Redistributions in binary form must reproduce the above copyright notice,
76- # this list of conditions and the following disclaimer in the documentation
77- # and/or other materials provided with the distribution.
78- #
79- # * Neither the name of the copyright holder nor the names of its
80- # contributors may be used to endorse or promote products derived from
81- # this software without specific prior written permission.
82- #
83- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
84- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
85- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
86- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
87- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
88- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
89- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
90- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
91- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
92- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
93- # POSSIBILITY OF SUCH DAMAGE.
94- __TEXT__
95-
96- FILES_TO_TEST=$@
97-
98- count=0
99- for FILE in $FILES_TO_TEST ; do
100- # Check whether file has a size greater than zero.
101- if [[ -s $FILE ]]; then
102- file_contents=$( < $FILE )
103- if [[ " $file_contents " != * " $expected " * ]]; then
104- echo " Unexpected licence information: ${FILE# $IMPROVER_DIR } "
105- count=$(( count+ 1 ))
106- fi
107- fi
108- done
109- if (( $count > 0 )) ; then
110- echo_fail " IMPROVER licences"
111- exit 1
112- fi
113- }
114-
115- function improver_test_licence {
116- # utf8 and BSD 3-clause licence testing.
117- licence_check $FILES_TO_TEST
118- echo_ok " IMPROVER licences"
119- }
120-
12159function improver_test_black {
12260 ${BLACK:- black} $FILES_TO_TEST
12361 echo_ok " black"
@@ -128,7 +66,6 @@ function improver_test_isort {
12866 echo_ok " isort"
12967}
13068
131-
13269function improver_test_pylint {
13370 # Pylint score generation.
13471 ${PYLINT:- pylint} --rcfile=etc/pylintrc $FILES_TO_TEST
@@ -208,9 +145,9 @@ Optional arguments:
208145
209146Arguments:
210147 SUBTEST Name(s) of a subtest to run without running the rest.
211- Valid names are: black, isort, pylint, pylintE, licence,
148+ Valid names are: black, isort, pylint, pylintE,
212149 doc, unit, cli, and recreate_checksums. The default tests
213- are black, isort, pylintE, licence, doc, unit,
150+ are black, isort, pylintE, doc, unit,
214151 and cli.
215152 Using recreate_checksums will regenerate the
216153 test data checksum file which is used as part of the cli
@@ -255,7 +192,7 @@ for arg in "$@"; do
255192 print_usage
256193 exit 0
257194 ;;
258- black|isort|pylint|pylintE|licence| doc|unit|cli|recreate_checksums)
195+ black|isort|pylint|pylintE|doc|unit|cli|recreate_checksums)
259196 SUBTESTS=" $SUBTESTS $arg "
260197 ;;
261198 $cli_tasks )
@@ -273,7 +210,7 @@ if [[ -n "$SUBTESTS" ]]; then
273210 TESTS=" $SUBTESTS "
274211else
275212 # Default tests.
276- TESTS=" isort black pylintE licence doc unit cli"
213+ TESTS=" isort black pylintE doc unit cli"
277214fi
278215
279216# If cli sub test is not specified by user, do all cli tests.
0 commit comments