Loading scripts/prepare_combined_format_inputs.py +92 −88 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import numpy as np from pyaudio3dtools import audiofile, audioarray def main(): FS = [48, 32, 16] # scripts/testv/ path Loading Loading @@ -137,3 +138,6 @@ for fs in FS: # info print. helps setting up .gitignore if len(wrote_files) > 0: print('New files written: {}'.format('\n'.join(wrote_files))) if __name__ == "__main__": main() No newline at end of file scripts/self_test.py +15 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ import multiprocessing import tempfile import urllib.parse import shutil import prepare_combined_format_inputs import errno BW_TO_SR = {"nb": 8, "wb": 16, "swb": 32, "fb": 48} Loading Loading @@ -993,6 +995,18 @@ class SelfTest(IvasScriptsCommon.IvasScript): {oc: list(map(self.test_for_file, dec_cmd))} ) # check if we need to produce missing combined formats if not os.path.exists(in_file): if is_osba_or_omasa: self.logger.info("Creating missing combined formats test vectors...") prepare_combined_format_inputs.main() if not os.path.exists(in_file): self.logger.error(f"Test vector {in_file} does not exist!") raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), in_file) else: self.logger.error(f"Test vector {in_file} does not exist!") raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), in_file) # handle intermediate processing steps, e.g. networksimulator, eid-xor, ... in_file = bs_enc_file proc_cmds = [] Loading @@ -1008,7 +1022,7 @@ class SelfTest(IvasScriptsCommon.IvasScript): proc_cmd[0] = os.path.join(TOOLS_DIR, proc_cmd[0]) proc_cmd = [ "{in_file}" if x == in_file else self.test_for_file(x) for x in proc_cmd "{in_file}" if x == in_file else x for x in proc_cmd ] if mode[1]: for cmdline_arg in proc_cmd[1:]: Loading tests/conftest.py +13 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,12 @@ import tempfile logger = logging.getLogger(__name__) USE_LOGGER_FOR_DBG = False # current tests do not make use of the logger feature HERE = Path(__file__).parent SCRIPTS_DIR = str(HERE.parent.joinpath("scripts").absolute()) import sys sys.path.append(SCRIPTS_DIR) import prepare_combined_format_inputs def log_dbg_msg(message): """ Loading Loading @@ -175,6 +181,13 @@ def update_ref(request): """ return int(request.config.getoption("--update_ref")) @pytest.fixture(scope="session", autouse=True) def create_combined_formats_testvectors(request): """ Create input stv files for the combined formats if missing """ prepare_combined_format_inputs.main() @pytest.fixture(scope="session", autouse=True) def get_mld(request): Loading Loading
scripts/prepare_combined_format_inputs.py +92 −88 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import numpy as np from pyaudio3dtools import audiofile, audioarray def main(): FS = [48, 32, 16] # scripts/testv/ path Loading Loading @@ -137,3 +138,6 @@ for fs in FS: # info print. helps setting up .gitignore if len(wrote_files) > 0: print('New files written: {}'.format('\n'.join(wrote_files))) if __name__ == "__main__": main() No newline at end of file
scripts/self_test.py +15 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ import multiprocessing import tempfile import urllib.parse import shutil import prepare_combined_format_inputs import errno BW_TO_SR = {"nb": 8, "wb": 16, "swb": 32, "fb": 48} Loading Loading @@ -993,6 +995,18 @@ class SelfTest(IvasScriptsCommon.IvasScript): {oc: list(map(self.test_for_file, dec_cmd))} ) # check if we need to produce missing combined formats if not os.path.exists(in_file): if is_osba_or_omasa: self.logger.info("Creating missing combined formats test vectors...") prepare_combined_format_inputs.main() if not os.path.exists(in_file): self.logger.error(f"Test vector {in_file} does not exist!") raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), in_file) else: self.logger.error(f"Test vector {in_file} does not exist!") raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), in_file) # handle intermediate processing steps, e.g. networksimulator, eid-xor, ... in_file = bs_enc_file proc_cmds = [] Loading @@ -1008,7 +1022,7 @@ class SelfTest(IvasScriptsCommon.IvasScript): proc_cmd[0] = os.path.join(TOOLS_DIR, proc_cmd[0]) proc_cmd = [ "{in_file}" if x == in_file else self.test_for_file(x) for x in proc_cmd "{in_file}" if x == in_file else x for x in proc_cmd ] if mode[1]: for cmdline_arg in proc_cmd[1:]: Loading
tests/conftest.py +13 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,12 @@ import tempfile logger = logging.getLogger(__name__) USE_LOGGER_FOR_DBG = False # current tests do not make use of the logger feature HERE = Path(__file__).parent SCRIPTS_DIR = str(HERE.parent.joinpath("scripts").absolute()) import sys sys.path.append(SCRIPTS_DIR) import prepare_combined_format_inputs def log_dbg_msg(message): """ Loading Loading @@ -175,6 +181,13 @@ def update_ref(request): """ return int(request.config.getoption("--update_ref")) @pytest.fixture(scope="session", autouse=True) def create_combined_formats_testvectors(request): """ Create input stv files for the combined formats if missing """ prepare_combined_format_inputs.main() @pytest.fixture(scope="session", autouse=True) def get_mld(request): Loading