Skip to content

Commit

Permalink
Relax dependencies so that Python 3.6 can be also used, fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
BlankSpruce committed Aug 25, 2020
1 parent 8c73beb commit c14524a
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 24 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cache: false

_tox: &tox
install:
- pip3 install tox
- pip3 install tox tox-travis
script:
- tox

Expand All @@ -17,6 +17,11 @@ jobs:
script:
- cd editors/emacs && emacs -batch -l ert -l gersemi.el -l gersemi-tests.el -f ert-run-tests-batch-and-exit

- language: python
os: linux
python: "3.6"
<<: *tox

- language: python
os: linux
python: "3.7"
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [0.5.0] 2020-08-25

### Added
- minor performance improvements
- support for Python 3.6

### Changed
- files are taken as input only once even if provided multiple times
- files are no longer overwritten if reformatting wouldn't lead to change of content
- dependency to `packaging`

## [0.4.0] 2020-08-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion gersemi/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
__license__ = "MPL 2.0"
__title__ = "gersemi"
__url__ = "https://github.com/BlankSpruce/gersemi"
__version__ = "0.4.0"
__version__ = "0.5.0"
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
url=about["__url__"],
packages=find_packages(include=["gersemi", "gersemi.*"]),
package_data={"gersemi": ["cmake.lark", "builtin_commands"]},
install_requires=["lark-parser>=0.8,<0.10", "pyyaml>=5,<6"],
install_requires=["dataclasses", "lark-parser>=0.8,<0.10", "pyyaml>=5,<6"],
extras_requires=["colorama>=0.4"],
python_requires=">=3.7",
python_requires=">=3.6",
entry_points={"console_scripts": ["gersemi = gersemi.__main__:main"]},
license=about["__license__"],
classifiers=[
Expand Down
32 changes: 14 additions & 18 deletions tests/test_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def gersemi(*gersemi_args, **subprocess_kwargs):
return subprocess.run(
[sys.executable, "-m", "gersemi", *gersemi_args],
check=False,
encoding="utf8",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
**subprocess_kwargs,
)

Expand Down Expand Up @@ -161,18 +164,18 @@ def test_format_file_in_place():
def test_check_formatted_input_from_stdin():
inp = """set(FOO BAR)
"""
assert_success("--check", "-", input=inp, text=True)
assert_success("--check", "-", input=inp)


def test_check_not_formatted_input_from_stdin():
inp = """set(FOO BAR)""" # missing newline at the end
assert_fail("--check", "-", input=inp, text=True)
assert_fail("--check", "-", input=inp)


def test_format_formatted_input_from_stdin():
inp = """set(FOO BAR)
"""
completed_process = gersemi("-", input=inp, text=True, capture_output=True)
completed_process = gersemi("-", input=inp)
assert completed_process.returncode == 0
assert completed_process.stdout == inp
assert completed_process.stderr == ""
Expand All @@ -181,7 +184,7 @@ def test_format_formatted_input_from_stdin():
def test_format_not_formatted_input_from_stdin():
inp = "set(FOO BAR)" # missing newline at the end

completed_process = gersemi("-", input=inp, text=True, capture_output=True)
completed_process = gersemi("-", input=inp)
assert completed_process.returncode == 0
assert completed_process.stdout == inp + "\n"
assert completed_process.stderr == ""
Expand Down Expand Up @@ -302,7 +305,7 @@ def test_format_with_default_line_length():
inp = "set(FOO long_argument__________________________________________________________)"
outp = inp + "\n"
assert len(inp) == 80
completed_process = gersemi("-", input=inp + "\n", text=True, capture_output=True)
completed_process = gersemi("-", input=inp + "\n")
assert completed_process.returncode == 0
assert completed_process.stdout == outp
assert completed_process.stderr == ""
Expand All @@ -313,7 +316,7 @@ def test_format_with_default_line_length():
)
"""
assert len(inp2) > 80
completed_process = gersemi("-", input=inp2 + "\n", text=True, capture_output=True)
completed_process = gersemi("-", input=inp2 + "\n")
assert completed_process.returncode == 0
assert completed_process.stdout == outp2
assert completed_process.stderr == ""
Expand All @@ -329,8 +332,7 @@ def test_format_with_non_default_line_length():
str(line_length),
"-",
input=inp + "\n",
text=True,
capture_output=True,
universal_newlines=True,
)
assert completed_process.returncode == 0
assert completed_process.stdout == outp
Expand All @@ -347,8 +349,7 @@ def test_format_with_non_default_line_length():
str(line_length),
"-",
input=inp2 + "\n",
text=True,
capture_output=True,
universal_newlines=True,
)
assert completed_process.returncode == 0
assert completed_process.stdout == outp2
Expand Down Expand Up @@ -400,9 +401,7 @@ def test_format_project_with_custom_commands_but_without_definitions():


def test_non_empty_stderr_when_files_are_not_formatted():
completed_process = gersemi(
"--check", case("custom_project/not_formatted"), text=True, capture_output=True,
)
completed_process = gersemi("--check", case("custom_project/not_formatted"))
assert completed_process.returncode == 1
assert completed_process.stderr != ""

Expand All @@ -412,8 +411,7 @@ def test_empty_stderr_when_files_are_not_formatted_but_quiet_is_supplied():
"--check",
case("custom_project/not_formatted"),
"--quiet",
text=True,
capture_output=True,
universal_newlines=True,
)
assert completed_process.returncode == 1
assert completed_process.stderr == ""
Expand Down Expand Up @@ -594,9 +592,7 @@ def test_use_configuration_file_from_current_directory_when_input_is_from_stdin(
assert len(inp) > line_length

with create_dot_gersemirc(where=".", line_length=30):
completed_process = gersemi(
"-", input=inp + "\n", text=True, capture_output=True,
)
completed_process = gersemi("-", input=inp + "\n")
assert completed_process.returncode == 0
assert completed_process.stdout == outp
assert completed_process.stderr == ""
13 changes: 11 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
[tox]
envlist = tests, lint, format, mypy
envlist = py36, py37, py38, lint, format, mypy
skip_missing_interpreters=true

[testenv:tests]
[travis]
python =
3.6: py36
3.7: py37
3.8: py38, lint, format, mypy

[testenv]
deps =
pytest
pytest-clarity
pytest-xdist
commands =
pytest {posargs:-n auto}

[testenv:tests]

[testenv:lint]
deps =
pylint
Expand Down

0 comments on commit c14524a

Please sign in to comment.