Commit f5715693 authored by norvell's avatar norvell
Browse files

Remove duplicated function check_and_makedir

parent 42cbaa9d
Loading
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ from tests.constants import (
    SCRIPTS_DIR,
    MAX_ENC_DIFF,
)
import tests.renderer.utils as rend
from tests.renderer.utils import check_and_makedir, binauralize_input_and_output

PASSTHROUGH_CONF = [
    (r"[\s\S]*", "EXT"),  # Any input with EXT output is pass-through
@@ -154,15 +154,6 @@ with open(PARAM_FILE, "r", encoding="UTF-8") as fp:
        param_file_test_dict[tag] = (enc_opts, dec_opts, sim_opts, eid_opts)


def check_and_makedir(dir_path):
    if not os.path.exists(dir_path):
        try:
            os.makedirs(dir_path)
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise  # raises the error again


def convert_test_string_to_tag(test_string):
    """
    Convert a test string (i.e. the test tag from the parameter file) to a tag string.
@@ -457,7 +448,7 @@ def test_param_file_tests(

            record_property = dut_decoder_frontend.record_property if dut_decoder_frontend else ref_decoder_frontend.record_property

            (ref_output_file, dut_output_file) = rend.binauralize_input_and_output(
            (ref_output_file, dut_output_file) = binauralize_input_and_output(
                    record_property,
                    props_to_record,
                    test_info,
+3 −11
Original line number Diff line number Diff line
@@ -44,7 +44,8 @@ from ..conftest import parse_properties
from ..cmp_stats_files import cmp_stats_files
from ..constants import TESTV_DIR, MAX_ENC_FILE_LENGTH_DIFF, MAX_ENC_STATS_DIFF
from tests.testconfig import use_ltv
import tests.renderer.utils as rend

from tests.renderer.utils import check_and_makedir, binauralize_input_and_output

tag_list = ["ltvFOA" if use_ltv else "stvFOA"]
tag_list_HOA2 = ["ltvHOA2" if use_ltv else "stv2OA"]
@@ -82,15 +83,6 @@ ivas_br_plc = ["13200", "16400", "32000", "64000", "96000", "256000"]
# SBA order to IVAS_rend format table
SBA_FORMAT={1: "FOA", 2: "HOA2", 3: "HOA3"}

def check_and_makedir(dir_path):
    if not os.path.exists(dir_path):
        try:
            os.makedirs(dir_path)
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise  # raises the error again


@pytest.mark.parametrize("tag", tag_list)
@pytest.mark.parametrize("sampling_rate", sample_rate_list)
def test_pca_enc(
@@ -1197,7 +1189,7 @@ def sba_dec(
            in_sr = sampling_rate
            out_sr = sampling_rate

            (ref_out_file, dut_out_file) = rend.binauralize_input_and_output(
            (ref_out_file, dut_out_file) = binauralize_input_and_output(
                dut_decoder_frontend.record_property,
                props_to_record,
                test_info,
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ from typing import Optional

import pytest

from tests.renderer.utils import check_BE, run_cmd, run_renderer, test_info
from tests.renderer.utils import check_BE, run_cmd, run_renderer

from .constants import *