forked from dictation-toolbox/unimacro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6380905
commit d879331
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
from string import Template | ||
from pathlib import Path | ||
import pytest | ||
from distutils.dir_util import copy_tree | ||
import natlink | ||
|
||
thisDir = Path(__file__).parent | ||
|
||
@pytest.fixture() | ||
def unimacro_setup(tmpdir): | ||
|
||
tmp_test_root = tmpdir | ||
|
||
natlink_config_dir=tmp_test_root.mkdir('.natlink') | ||
unimacro_userdir=tmp_test_root.mkdir("unimacro_user_directory") | ||
natlink_config_file=natlink_config_dir/"natlink.ini" | ||
|
||
sub={ | ||
'unimacrouserdirectory':unimacro_userdir | ||
} | ||
natlinkini_source_folder=Path(__file__).parent / "unimacro_test_natlink_config.natlink" | ||
natlinkini_source_config = natlinkini_source_folder/"natlink.ini" | ||
with open(natlinkini_source_config) as f: | ||
src=Template(f.read()) | ||
config_file_text=src.substitute(sub) | ||
|
||
print(f"natlink_config_dir: f{natlink_config_dir}") | ||
with open(natlink_config_file,'w') as fw: | ||
fw.write(config_file_text) | ||
|
||
#copy the unimacro user directory to the unimacro_user_directory | ||
copy_tree(str(thisDir/"test_sample_unimacro_userdir"),str(unimacro_userdir)) | ||
|
||
pytest.MonkeyPatch().setenv("NATLINK_USERDIR",str(natlink_config_dir)) | ||
oo=natlink.natConnect() | ||
yield [natlink_config_dir,unimacro_userdir,oo] | ||
natlink.natDisconnect() | ||
|
||
|
||
|
||
|
||
def test_foo(unimacro_setup): | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[directories] | ||
vocoladirectory = vocola2 | ||
vocolagrammarsdirectory = natlink_userdir\vocolagrammars | ||
unimacrodirectory = unimacro | ||
unimacrogrammarsdirectory = unimacro\unimacrogrammars | ||
|
||
[settings] | ||
log_level = DEBUG | ||
load_on_startup = True | ||
load_on_begin_utterance = False | ||
load_on_mic_on = True | ||
load_on_user_changed = True | ||
|
||
[manual configuration] | ||
instruction1 = set next line in the directories section when you | ||
instruction2 = want to define a Natlink user directory, independent of | ||
instruction3 = any package, like Dragonfly, Unimacro or Vocola. | ||
instruction4 = Note: you can drop a python grammar file in any of the directories, | ||
instruction5 = the distinction is made for package updates, and for convenience | ||
natlinkuserdirectory = ~\Documents\UserDirectory | ||
|
||
[vocola] | ||
vocolatakesunimacroactions = True | ||
vocolauserdirectory = ~\OneDrive\doug\VocolaGrammars | ||
|
||
[unimacro] | ||
unimacrouserdirectory = $unimacrouserdirectory | ||
|
||
[settings.debugadapterprotocol] | ||
dap_enabled = True | ||
dap_port = 7474 | ||
dap_wait_for_debugger_attach_on_startup = True | ||
|