def test_download(): bin_dir = os.path.join(TEMP_DIR, 'thirdparty', 'bin') if os.path.exists(bin_dir): shutil.rmtree(bin_dir, ignore_errors=True) assert not validate_kaldi_binaries() download_binaries() assert validate_kaldi_binaries()
def test_download(): bin_dir = os.path.join(TEMP_DIR, 'thirdparty', 'bin') if os.path.exists(bin_dir): shutil.rmtree(bin_dir, ignore_errors=True) assert not validate_kaldi_binaries() command = ['thirdparty', 'download'] args, unknown = parser.parse_known_args(command) run_thirdparty(args) assert validate_kaldi_binaries()
def generated_dir(test_dir): from montreal_forced_aligner.thirdparty.kaldi import validate_kaldi_binaries if not validate_kaldi_binaries(): from montreal_forced_aligner.thirdparty.download import download_binaries download_binaries() actually_working = validate_kaldi_binaries() if not actually_working: raise Exception( 'Kaldi binaries are not correctly found or functioning.') generated = os.path.join(test_dir, 'generated') shutil.rmtree(generated, ignore_errors=True) if not os.path.exists(generated): os.makedirs(generated) return generated
def test_collect(): bin_dir = os.path.join(TEMP_DIR, 'thirdparty', 'bin') backup_dir = os.path.join(TEMP_DIR, 'thirdparty', 'bin_backup') if os.path.exists(backup_dir): shutil.rmtree(backup_dir) assert validate_kaldi_binaries() shutil.move(bin_dir, backup_dir) assert not validate_kaldi_binaries() collect_kaldi_binaries(backup_dir) assert validate_kaldi_binaries()
def test_collect(): bin_dir = os.path.join(TEMP_DIR, 'thirdparty', 'bin') backup_dir = os.path.join(TEMP_DIR, 'thirdparty', 'bin_backup') if os.path.exists(backup_dir): shutil.rmtree(backup_dir) assert validate_kaldi_binaries() shutil.move(bin_dir, backup_dir) assert not validate_kaldi_binaries() command = ['thirdparty', 'kaldi', backup_dir] args, unknown = parser.parse_known_args(command) run_thirdparty(args) assert validate_kaldi_binaries()