Loading ci/remove_unsupported_testcases.py +54 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,8 @@ TESTCASES = [ "OMASA 2TC 2ISM br sw techs 13.2 to 512 kbps start 48 kbps, 48kHz in, 48kHz out, BINAURAL out, object editing", ] RENDERER_PYTEST_FILE = "tests/renderer/test_renderer.py" def remove_testcases(cfg: Path, testcases: list): """ Loading @@ -86,6 +88,56 @@ def remove_testcases(cfg: Path, testcases: list): f.write("".join(content_out)) def skip_testcase( lines: list[str], function_name: str, condition: str, reason: str ) -> int: i = find_function(lines, function_name) skip_lines = [ f" if {condition}:\n", f' pytest.skip("{reason}")\n', ] lines[i:i] = skip_lines return lines def find_function(lines: list[str], function_name: str) -> int: found_function = False for i, line in enumerate(lines): if f"def {function_name}" in line: found_function = True continue if found_function and "run_renderer(" in line: return i def remove_testcases_renderer(): with open(RENDERER_PYTEST_FILE) as f: lines = f.readlines() lines = skip_testcase( lines, function_name="test_osba_binaural_static", condition="out_fmt == 'BINAURAL_ROOM_IR' and fs == '32kHz'", reason="Unsupported for BASOP", ) lines = skip_testcase( lines, function_name="test_osba_binaural_headrotation", condition="out_fmt == 'BINAURAL_ROOM_IR' and fs == '32kHz'", reason="Unsupported for BASOP", ) lines = skip_testcase( lines, function_name="test_multichannel_binaural_headrotation", condition="out_fmt == 'BINAURAL_ROOM_IR' and fs == '32kHz' and in_fmt in ['5_1', '7_1'] and frame_size == '20ms'", reason="Unsupported for BASOP", ) with open(RENDERER_PYTEST_FILE, "w") as f: f.writelines(lines) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("cfg_files", nargs="+", type=Path) Loading @@ -95,3 +147,5 @@ if __name__ == "__main__": for f in args.cfg_files: remove_testcases(f, testcases) remove_testcases_renderer() tests/renderer/constants.py +1 −1 File changed.Contains only whitespace changes. Show changes Loading
ci/remove_unsupported_testcases.py +54 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,8 @@ TESTCASES = [ "OMASA 2TC 2ISM br sw techs 13.2 to 512 kbps start 48 kbps, 48kHz in, 48kHz out, BINAURAL out, object editing", ] RENDERER_PYTEST_FILE = "tests/renderer/test_renderer.py" def remove_testcases(cfg: Path, testcases: list): """ Loading @@ -86,6 +88,56 @@ def remove_testcases(cfg: Path, testcases: list): f.write("".join(content_out)) def skip_testcase( lines: list[str], function_name: str, condition: str, reason: str ) -> int: i = find_function(lines, function_name) skip_lines = [ f" if {condition}:\n", f' pytest.skip("{reason}")\n', ] lines[i:i] = skip_lines return lines def find_function(lines: list[str], function_name: str) -> int: found_function = False for i, line in enumerate(lines): if f"def {function_name}" in line: found_function = True continue if found_function and "run_renderer(" in line: return i def remove_testcases_renderer(): with open(RENDERER_PYTEST_FILE) as f: lines = f.readlines() lines = skip_testcase( lines, function_name="test_osba_binaural_static", condition="out_fmt == 'BINAURAL_ROOM_IR' and fs == '32kHz'", reason="Unsupported for BASOP", ) lines = skip_testcase( lines, function_name="test_osba_binaural_headrotation", condition="out_fmt == 'BINAURAL_ROOM_IR' and fs == '32kHz'", reason="Unsupported for BASOP", ) lines = skip_testcase( lines, function_name="test_multichannel_binaural_headrotation", condition="out_fmt == 'BINAURAL_ROOM_IR' and fs == '32kHz' and in_fmt in ['5_1', '7_1'] and frame_size == '20ms'", reason="Unsupported for BASOP", ) with open(RENDERER_PYTEST_FILE, "w") as f: f.writelines(lines) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("cfg_files", nargs="+", type=Path) Loading @@ -95,3 +147,5 @@ if __name__ == "__main__": for f in args.cfg_files: remove_testcases(f, testcases) remove_testcases_renderer()