diff --git a/hack/boilerplate/boilerplate_test.py b/hack/boilerplate/boilerplate_test.py index d95194b2211..8fc7e4cbcb1 100644 --- a/hack/boilerplate/boilerplate_test.py +++ b/hack/boilerplate/boilerplate_test.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import boilerplate -import unittest -from io import StringIO import os import sys +import unittest +from io import StringIO + +import boilerplate class TestBoilerplate(unittest.TestCase): """ @@ -31,19 +32,19 @@ class TestBoilerplate(unittest.TestCase): def test_boilerplate(self): os.chdir("test/") - class Args(object): - def __init__(self): - self.filenames = [] - self.rootdir = "." - self.boilerplate_dir = "../" - self.verbose = True + class Args: + filenames = [] + rootdir = "." + boilerplate_dir = "../" + verbose = True # capture stdout old_stdout = sys.stdout sys.stdout = StringIO() - boilerplate.args = Args() + boilerplate.args = Args ret = boilerplate.main() + self.assertEqual(ret, 0) output = sorted(sys.stdout.getvalue().split())