-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix more things related to the pathlib port
Add more tests to improve coverage
- Loading branch information
Showing
8 changed files
with
112 additions
and
11 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
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
Empty file.
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,4 @@ | ||
frontend: | ||
module: | ||
documents: | ||
- '{{module.module_name|lower}}module.txt': 'module.txt' |
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 @@ | ||
{{module}} |
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,4 @@ | ||
frontend: | ||
module: | ||
documents: | ||
- '{{module.module_name|lower}}module.txt': 'module.txt' |
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,59 @@ | ||
import logging | ||
import logging.config | ||
import subprocess | ||
import os | ||
import tempfile | ||
from pathlib import Path | ||
|
||
|
||
# logging.config.fileConfig('logging.ini') | ||
logging.basicConfig() | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
here = Path(__file__).parent | ||
|
||
inputPath = Path('tests/in') | ||
log.debug('input path folder: {0}'.format(inputPath.absolute())) | ||
|
||
env = os.environ.copy() | ||
env['PYTHONPATH'] = str(here.parent) | ||
|
||
def test_help(): | ||
result = subprocess.run(['python3', './qface/app.py', "--help"], stdout=subprocess.PIPE, env=env) | ||
assert result.returncode == 0 | ||
assert """ | ||
Usage: app.py [OPTIONS] [SOURCE]... | ||
Options: | ||
--rules PATH [required] | ||
--target DIRECTORY | ||
--reload / --no-reload Auto reload script on changes | ||
--scaffold / --no-scaffold Add extrac scaffolding code | ||
--watch DIRECTORY | ||
--feature TEXT | ||
--run TEXT run script after generation | ||
--force / --no-force forces overwriting of files | ||
--help Show this message and exit. | ||
""", result.stdout | ||
|
||
def test_generate(): | ||
tmpDir = tempfile.TemporaryDirectory() | ||
result = subprocess.run(['python3', './qface/app.py', "--rules", "tests/app_templates/rules.yaml", "--target", tmpDir.name, "--force", "tests/in/com.pelagicore.ivi.tuner.qface"], stdout=subprocess.PIPE, env=env) | ||
assert result.returncode == 0 | ||
assert """ | ||
merge: com.pelagicore.ivi.tuner.yaml | ||
process: frontend | ||
""", result.stdout | ||
|
||
def test_generate_and_run(): | ||
tmpDir = tempfile.TemporaryDirectory() | ||
result = subprocess.run(['python3', './qface/app.py', "--rules", "tests/app_templates/rules.yaml", "--target", tmpDir.name, "--force", "tests/in/com.pelagicore.ivi.tuner.qface", "--run", "echo DONE"], stdout=subprocess.PIPE, env=env) | ||
assert result.returncode == 0 | ||
assert """ | ||
merge: com.pelagicore.ivi.tuner.yaml | ||
process: frontend | ||
$ echo DONE | ||
DONE | ||
""", result.stdout | ||
|
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