Skip to content

Commit

Permalink
Add --generate-missing-only flag to run_tests.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kezsulap committed Nov 10, 2024
1 parent 9ffb873 commit c1339e1
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,16 @@ def main():
parser.add_argument('--add-alternate-outputs', '-a', action='store_true')
parser.add_argument('--output_name', '-o')
parser.add_argument('--open-all', '-p', action='store_true')
parser.add_argument('--generate-missing-only', '-g', action='store_true')
args = parser.parse_args()
if args.add_new_outputs and args.add_alternate_outputs:
print('Combining --add-new-outputs with --add-alternate-outputs is invalid')
sys.exit(1)

if args.dont_create_if_no_output and args.generate_missing_only:
print('Combining --dont-create-if-no-output with --generate-missing-only is invalid')
sys.exit(1)

failed_tests = []
tests = fetch_test_files()
test_names = [get_test_name(output) for (input, output) in tests]
Expand All @@ -81,6 +86,13 @@ def main():

for inputs, output in tests:
test_name = get_test_name(output)
try:
os.mkdir(output)
except FileExistsError:
pass
possible_outputs = sorted(os.listdir(output))
if possible_outputs and args.generate_missing_only:
continue
if args.files and not any([matches(matcher, test_name) for matcher in args.files]):
continue;
with tempfile.NamedTemporaryFile(suffix='.html', delete=False) as f:
Expand All @@ -94,11 +106,6 @@ def main():
test_log = f'RUNNING TEST: {test_name}\n{all_inputs}\n\tOUTPUT: file://{output_name}\n'
test_outputs.append(f'file://{output_name}')
test_output = get_content(f'file://{output_name}')
try:
os.mkdir(output)
except FileExistsError:
pass
possible_outputs = sorted(os.listdir(output))
if not possible_outputs:
if args.dont_create_if_no_output:
test_log += f'\tNo output file found, ERROR'
Expand Down

0 comments on commit c1339e1

Please sign in to comment.