Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure test quality via linting #42

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/resources/sut-json-load.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys


with open(sys.argv[1], 'r') as f:
with open(sys.argv[1], 'r', encoding='utf-8') as f:
j = json.load(f)

print(repr(j))
print(f'{j!r}')
9 changes: 5 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Copyright (c) 2016-2022 Renata Hodovan, Akos Kiss.
# Copyright (c) 2016-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.

import os
import pytest
import subprocess
import sys

import pytest


is_windows = sys.platform.startswith('win32')
script_ext = '.bat' if is_windows else '.sh'
Expand Down Expand Up @@ -40,8 +41,8 @@
def test_cli(test, inp, exp, grammar, rule, input_format, args, tmpdir):
out_dir = str(tmpdir)
cmd = (sys.executable, '-m', 'picireny') \
+ (f'--test={test}{script_ext}', f'--input={inp}', f'--out={out_dir}') \
+ ('--log-level=TRACE', )
+ (f'--test={test}{script_ext}', f'--input={inp}', f'--out={out_dir}') \
+ ('--log-level=TRACE', )
if grammar:
cmd += (f'--grammar={grammar}', )
if rule:
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ omit = **/parser/*
deps =
pycodestyle
pylint
pytest
commands =
pylint picireny
pycodestyle picireny --ignore=E501 --exclude=picireny/antlr4/parser/ANTLRv4*.py
pylint picireny tests
pycodestyle picireny tests --ignore=E501 --exclude=picireny/antlr4/parser/ANTLRv4*.py

[testenv:build]
deps =
Expand Down