From 22304ab00a926f06f2f85f8aa21d651f8e3e115f Mon Sep 17 00:00:00 2001 From: sarah Date: Thu, 16 Jan 2020 15:21:04 -0500 Subject: [PATCH] Fixed Exception --- support/SimplerTestCase.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/support/SimplerTestCase.py b/support/SimplerTestCase.py index c8bf1ff..f217612 100644 --- a/support/SimplerTestCase.py +++ b/support/SimplerTestCase.py @@ -13,9 +13,12 @@ def assertTrue(self, expr, msg=None): @staticmethod def load_ast_tree(filename): - with open(filename) as f: - fstr = f.read() - return ast.parse(fstr, filename=filename) + try: + with open(filename) as f: + fstr = f.read() + return ast.parse(fstr, filename=filename) + except: + return ast.parse("()") @staticmethod def check_keyword(keyword, arg, val_val=None, val_id=None, val_attr=None): @@ -26,7 +29,7 @@ def check_keyword(keyword, arg, val_val=None, val_id=None, val_attr=None): return True def check_migration(self, migration_dir, model_name): - print(migration_dir, model_name) + # print(migration_dir, model_name) for file in os.listdir(migration_dir): full_path = os.path.join(migration_dir, file) (path, ext) = os.path.splitext(full_path)