ldcheck.py

changeset 38
66c9591b733d
parent 36
2753aad79678
child 47
4da025d0b283
equal deleted inserted replaced
37:e46fa477007b 38:66c9591b733d
114 parser.add_argument('filename') 114 parser.add_argument('filename')
115 parser.add_argument('--list', 115 parser.add_argument('--list',
116 action = ListTestSuiteAction, 116 action = ListTestSuiteAction,
117 help = 'Lists all possible checks and exit', 117 help = 'Lists all possible checks and exit',
118 ) 118 )
119 parser.add_argument('--dump-structure', action = 'store_true')
120 parser.add_argument('--rebuild', action = 'store_true')
119 args = parser.parse_args() 121 args = parser.parse_args()
120 config = load_config('ldcheck.cfg') 122 config = load_config('ldcheck.cfg')
121 for ldconfig_ldr_path in find_ldconfig_ldr_paths(config): 123 for ldconfig_ldr_path in find_ldconfig_ldr_paths(config):
122 with ldconfig_ldr_path.open() as ldconfig_ldr: 124 with ldconfig_ldr_path.open() as ldconfig_ldr:
123 load_colours(ldconfig_ldr) 125 load_colours(ldconfig_ldr)
126 model = read_ldraw( 128 model = read_ldraw(
127 file, 129 file,
128 name = basename(args.filename), 130 name = basename(args.filename),
129 config = config, 131 config = config,
130 ) 132 )
131 from testsuite import load_tests, check_model, format_report 133 if args.dump_structure:
132 test_suite = load_tests() 134 for entry in model.body:
133 report = check_model(model, test_suite) 135 print(entry)
134 print(format_report(report, model, test_suite)) 136 elif args.rebuild:
137 for entry in model.body:
138 print(entry.textual_representation(), end = '\r\n')
139 else:
140 from testsuite import load_tests, check_model, format_report
141 test_suite = load_tests()
142 report = check_model(model, test_suite)
143 print(format_report(report, model, test_suite))

mercurial