forked from MontrealCorpusTools/Montreal-Forced-Aligner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_commandline_configure.py
58 lines (50 loc) · 1.63 KB
/
test_commandline_configure.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import click.testing
import pytest
from montreal_forced_aligner.command_line.mfa import mfa_cli
from montreal_forced_aligner.config import generate_config_path
@pytest.mark.skip()
def test_configure(
temp_dir,
basic_corpus_dir,
generated_dir,
english_dictionary,
basic_align_config_path,
english_acoustic_model,
global_config,
):
path = generate_config_path()
if os.path.exists(path):
os.remove(path)
command = [
"configure",
"--always_clean",
"-t",
temp_dir,
"-j",
"10",
"--disable_mp",
"--always_verbose",
]
click.testing.CliRunner().invoke(mfa_cli, command, catch_exceptions=False)
assert os.path.exists(path)
global_config.load()
assert global_config.current_profile_name == "test"
assert global_config.current_profile.num_jobs == 10
assert not global_config.current_profile.use_mp
assert global_config.current_profile.verbose
assert global_config.current_profile.clean
command = ["configure", "--never_clean", "--enable_mp", "--never_verbose"]
click.testing.CliRunner().invoke(mfa_cli, command, catch_exceptions=False)
assert os.path.exists(path)
global_config.load()
assert global_config.current_profile_name == "test"
assert global_config.current_profile.use_mp
assert not global_config.current_profile.verbose
assert not global_config.current_profile.clean
global_config.clean = True
global_config.debug = True
global_config.verbose = True
global_config.use_mp = False
global_config.temporary_directory = temp_dir
global_config.save()