Removed call to tf.Session (useless + incompatible with tf2)

This commit is contained in:
romi1502
2020-09-25 13:18:36 +02:00
parent 2af82f5fe5
commit 3df2fa36cc

View File

@@ -42,7 +42,6 @@ print("RUNNING TESTS WITH TF VERSION {}".format(tf.__version__))
@pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS) @pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS)
def test_separate(test_file, configuration, backend): def test_separate(test_file, configuration, backend):
""" Test separation from raw data. """ """ Test separation from raw data. """
with tf.Session() as sess:
instruments = MODEL_TO_INST[configuration] instruments = MODEL_TO_INST[configuration]
adapter = get_default_audio_adapter() adapter = get_default_audio_adapter()
waveform, _ = adapter.load(test_file) waveform, _ = adapter.load(test_file)
@@ -63,7 +62,6 @@ def test_separate(test_file, configuration, backend):
@pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS) @pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS)
def test_separate_to_file(test_file, configuration, backend): def test_separate_to_file(test_file, configuration, backend):
""" Test file based separation. """ """ Test file based separation. """
with tf.Session() as sess:
instruments = MODEL_TO_INST[configuration] instruments = MODEL_TO_INST[configuration]
separator = Separator(configuration, stft_backend=backend) separator = Separator(configuration, stft_backend=backend)
name = splitext(basename(test_file))[0] name = splitext(basename(test_file))[0]
@@ -80,7 +78,6 @@ def test_separate_to_file(test_file, configuration, backend):
@pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS) @pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS)
def test_filename_format(test_file, configuration, backend): def test_filename_format(test_file, configuration, backend):
""" Test custom filename format. """ """ Test custom filename format. """
with tf.Session() as sess:
instruments = MODEL_TO_INST[configuration] instruments = MODEL_TO_INST[configuration]
separator = Separator(configuration, stft_backend=backend) separator = Separator(configuration, stft_backend=backend)
name = splitext(basename(test_file))[0] name = splitext(basename(test_file))[0]
@@ -98,7 +95,6 @@ def test_filename_format(test_file, configuration, backend):
@pytest.mark.parametrize('test_file, configuration', MODELS_AND_TEST_FILES) @pytest.mark.parametrize('test_file, configuration', MODELS_AND_TEST_FILES)
def test_filename_conflict(test_file, configuration): def test_filename_conflict(test_file, configuration):
""" Test error handling with static pattern. """ """ Test error handling with static pattern. """
with tf.Session() as sess:
separator = Separator(configuration) separator = Separator(configuration)
with TemporaryDirectory() as directory: with TemporaryDirectory() as directory:
with pytest.raises(SpleeterError): with pytest.raises(SpleeterError):