This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update jinja and socketio dependencies, add basic CI testing (#5)
- Set flask secret - Update socketio dependencies and add very basic tests - Github actions workflow
- Loading branch information
Showing
9 changed files
with
428 additions
and
76 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,32 @@ | ||
name: Linting and testing | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install pipenv | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pipenv | ||
- id: cache-pipenv | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.local/share/virtualenvs | ||
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} | ||
- name: Install dependencies | ||
if: steps.cache-pipenv.outputs.cache-hit != 'true' | ||
run: | | ||
pipenv install --deploy --dev | ||
- run: pipenv run isort --recursive --diff . | ||
- run: pipenv run black --check . | ||
- run: pipenv run flake8 | ||
- run: pipenv run pytest |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
# pytest root |
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
[tool.black] | ||
line-length = 90 | ||
[tool.isort] | ||
multi_line_output = 3 | ||
include_trailing_comma = true | ||
force_grid_wrap = 0 | ||
use_parentheses = true | ||
ensure_newline_before_comments = true | ||
line_length = 88 |
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,3 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
extend-ignore = E203, W503 |
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 textwrap import dedent | ||
|
||
import pytest | ||
import textfsm | ||
|
||
from main import parse_textfsm | ||
|
||
|
||
def test_parse_textfsm_ok(): | ||
template = dedent( | ||
r""" | ||
Value FirstName ([\w]+) | ||
Value LastName ([\w]+) | ||
Start | ||
^${FirstName}.${LastName} | ||
""" | ||
) | ||
output, _ = parse_textfsm("a b c", template) | ||
assert {"FirstName": "a", "LastName": "b"} in output | ||
|
||
|
||
def test_parse_textfsm_exc(): | ||
template = dedent( | ||
r""" | ||
Value firstName ([\w]+) | ||
Value LastName ([\w]+) | ||
Start | ||
^${FirstName}.${LastName} | ||
""" | ||
) | ||
with pytest.raises(textfsm.Error): | ||
output, _ = parse_textfsm("a b c", template) |