| 6 | |
| 7 | |
| 8 | def copy_test(args, skip_if_exists=False, force=False): |
| 9 | source_file = f"tests_refsol/test_week_{args.week}_day_{args.day}.py" |
| 10 | target_file = f"tests/test_week_{args.week}_day_{args.day}.py" |
| 11 | if skip_if_exists and os.path.exists(target_file) and not force: |
| 12 | # diff the two files and warn if they are different |
| 13 | if Path(source_file).read_text() != Path(target_file).read_text(): |
| 14 | print( |
| 15 | f"[WARNING] {target_file} already exists and is different from {source_file}" |
| 16 | ) |
| 17 | print( |
| 18 | f"You can run `pdm run copy-test --week {args.week} --day {args.day} --force` to update it" |
| 19 | ) |
| 20 | return |
| 21 | print(f"copying {source_file} to {target_file}") |
| 22 | shutil.copyfile(source_file, target_file) |
| 23 | |
| 24 | |
| 25 | def test(args): |