File: update_fixtures_contains_specific_string.py

package info (click to toggle)
golang-github-linode-linodego 1.47.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 10,032 kB
  • sloc: makefile: 95; sh: 52; python: 24
file content (28 lines) | stat: -rw-r--r-- 976 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
import subprocess
from pathlib import Path

repo_dir = Path(__file__).parent.parent
directory = repo_dir / Path("test/integration/fixtures")

search_string = sys.argv[1]
failed_tests = []

for file in directory.glob("*"):
    if file.is_file():
        content = file.read_text()
        if search_string in content:
            print(f"Found {search_string} in {file}")
            test_case = file.name.split(".")[0]
            command = f"make ARGS=\"-run {test_case}\" fixtures"
            output = subprocess.run(command, shell=True, capture_output=True)
            if output.returncode == 0:
                print(f"Successfully ran '{command}'")
            else:
                print(f"Command {command} failed with error:")
                print(output.stderr.decode())
                failed_tests.append(test_case)
        else:
            print(f"Did not find {search_string} in {file}")

print(f"These fixture generations failed: {failed_tests}")