-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better test coverage for new features (#64)
fixed bug with "lint" command.
- Loading branch information
Showing
14 changed files
with
201 additions
and
93 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from __future__ import annotations | ||
|
||
from typing import List, TYPE_CHECKING | ||
from pathlib import Path | ||
from contextlib import suppress | ||
|
||
from jinja2 import Environment | ||
|
||
from grizzly_ls.utils import OnlyScenarioTag | ||
|
||
if TYPE_CHECKING: | ||
from logging import Logger | ||
|
||
|
||
def render_gherkin(path: str, content: str, logger: Logger) -> str: | ||
feature_file = Path(path) | ||
OnlyScenarioTag.logger = logger | ||
environment = Environment(autoescape=False, extensions=[OnlyScenarioTag]) | ||
environment.extend(feature_file=feature_file) | ||
template = environment.from_string(content) | ||
content = template.render() | ||
buffer: List[str] = [] | ||
# <!-- sanatize content | ||
for line in content.splitlines(): | ||
# make any html tag characters in comments are replaced with respective html entity code | ||
with suppress(Exception): | ||
if line.lstrip()[0] == '#': | ||
line = line.replace('<', '<') | ||
line = line.replace('>', '>') | ||
|
||
buffer.append(line) | ||
# // --> | ||
|
||
return '\n'.join(buffer) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from pathlib import Path | ||
|
||
from grizzly_ls.utils import run_command | ||
|
||
|
||
def test_cli_lint() -> None: | ||
cwd = Path(__file__).parent.parent.parent.parent / 'tests' / 'project' | ||
rc, output = run_command( | ||
['grizzly-ls', 'lint', '.'], | ||
cwd=cwd.as_posix(), | ||
) | ||
|
||
try: | ||
assert rc == 0 | ||
except AssertionError: | ||
print('\n'.join(output)) | ||
raise |
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
Oops, something went wrong.