need to force flush the RAM in between pytest calls and avoid multiprocess

This commit is contained in:
mmoussallam
2020-06-26 11:03:41 +02:00
parent 39af9502ab
commit caf8f393bd
2 changed files with 50 additions and 49 deletions

View File

@@ -27,7 +27,7 @@ build-gpu: clean
python3 setup.py sdist
test:
$(PYTEST_CMD)
$(foreach file, $(wildcard tests/test_*.py), $(PYTEST_CMD) $(file);)
deploy:

View File

@@ -42,11 +42,11 @@ print("RUNNING TESTS WITH TF VERSION {}".format(tf.__version__))
@pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS)
def test_separate(test_file, configuration, backend):
""" Test separation from raw data. """
with tf.Session() as sess:
tf.reset_default_graph()
instruments = MODEL_TO_INST[configuration]
adapter = get_default_audio_adapter()
waveform, _ = adapter.load(test_file)
separator = Separator(configuration, stft_backend=backend)
separator = Separator(configuration, stft_backend=backend, multiprocess=False)
prediction = separator.separate(waveform, test_file)
assert len(prediction) == len(instruments)
for instrument in instruments:
@@ -60,12 +60,13 @@ def test_separate(test_file, configuration, backend):
assert not np.allclose(track, prediction[compared])
@pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS)
def test_separate_to_file(test_file, configuration, backend):
""" Test file based separation. """
with tf.Session() as sess:
tf.reset_default_graph()
instruments = MODEL_TO_INST[configuration]
separator = Separator(configuration, stft_backend=backend)
separator = Separator(configuration, stft_backend=backend, multiprocess=False)
name = splitext(basename(test_file))[0]
with TemporaryDirectory() as directory:
separator.separate_to_file(
@@ -80,9 +81,9 @@ def test_separate_to_file(test_file, configuration, backend):
@pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS)
def test_filename_format(test_file, configuration, backend):
""" Test custom filename format. """
with tf.Session() as sess:
tf.reset_default_graph()
instruments = MODEL_TO_INST[configuration]
separator = Separator(configuration, stft_backend=backend)
separator = Separator(configuration, stft_backend=backend, multiprocess=False)
name = splitext(basename(test_file))[0]
with TemporaryDirectory() as directory:
separator.separate_to_file(
@@ -98,8 +99,8 @@ def test_filename_format(test_file, configuration, backend):
@pytest.mark.parametrize('test_file, configuration', MODELS_AND_TEST_FILES)
def test_filename_conflict(test_file, configuration):
""" Test error handling with static pattern. """
with tf.Session() as sess:
separator = Separator(configuration)
tf.reset_default_graph()
separator = Separator(configuration, multiprocess=False)
with TemporaryDirectory() as directory:
with pytest.raises(SpleeterError):
separator.separate_to_file(