Move out of travis.

This commit is contained in:
Julien Palard 2020-12-03 13:10:26 +01:00
parent a1a21ed2fd
commit e58507b36e
10 changed files with 69 additions and 40 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: JulienPalard

41
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
name: Run tox
runs-on: ubuntu-latest
strategy:
matrix:
tox:
- py_version: '3.6'
env: py36
- py_version: '3.7'
env: py37
- py_version: '3.8'
env: py38,flake8,mypy,black,pylint,pydocstyle,coverage
- py_version: '3.9'
env: py39
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.tox.py_version }}
- uses: actions/cache@v2
with:
path: .tox
key: ${{ matrix.tox.python-version }}-${{ hashFiles('tox.ini') }}-${{ hashFiles('requirements-dev.txt') }}
- name: Install dependencies
sudo apt-get update
sudo apt-get install -y gettext
- name: Install tox
run: python3 -m pip install tox
- name: Run tox
run: tox -q -p all -e ${{ matrix.tox.env }}

View File

@ -1,14 +0,0 @@
language: python
matrix:
include:
- python: "3.6"
env: TOX_ENV=py36
- python: "3.7"
env: TOX_ENV=py37
- python: "3.8"
env: TOX_ENV=py38,black,flake8,pylint,mypy
install:
- pip uninstall -y virtualenv
- pip install tox
script:
- tox -e $TOX_ENV

View File

@ -1,10 +1,7 @@
powrap
======
|build| |pypi|
.. |build| image:: https://travis-ci.org/JulienPalard/powrap.svg?branch=master
:target: https://travis-ci.org/JulienPalard/powrap
|pypi|
.. |pypi| image:: https://img.shields.io/pypi/v/powrap.svg
:target: https://pypi.python.org/pypi/powrap

View File

@ -1,7 +1,4 @@
"""Script to fix indentation of given ``.po`` files. If ``--modified`` is
given, it will only fix modified files according to git (usefull if
your ``.po`` files are versionned).
"""
"""Script to fix indentation of given ``.po`` files."""
__author__ = """Julien Palard"""
__email__ = "julien@palard.fr"

View File

@ -1,4 +1,3 @@
"""python -m powrap entry point.
"""
"""python -m powrap entry point."""
__import__("powrap.powrap").powrap.main()

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python3
"""Fix style of uncommited po files, or all if --all is given.
"""
"""Fix style of uncommited po files, or all if --all is given."""
import argparse
import sys
@ -108,7 +105,8 @@ def parse_args():
"--diff",
"-d",
action="store_true",
help="Don't write the files back, just output a diff for each file on stdout (implies --check).",
help="Don't write the files back, just output a diff for each file on stdout "
"(implies --check).",
)
parser.add_argument(
"--check",

View File

@ -5,7 +5,7 @@ description = Find and properly reindent .po files.
long_description = file: README.rst
author = Julien Palard
author_email = julien@palard.fr
url = https://github.com/JulienPalard/powrap
url = https://github.com/AFPy/powrap
keywords = powrap, po, gettext, i18n
license = MIT License
classifiers =
@ -17,6 +17,7 @@ classifiers =
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
[options]
packages = powrap

View File

@ -9,28 +9,32 @@ FIXTURE_DIR = Path(__file__).resolve().parent
@pytest.mark.parametrize("po_file", (FIXTURE_DIR / "bad" / "glossary.po",))
def test_fail_on_bad_wrapping(po_file):
assert powrap.check_style([po_file]) == [po_file]
def test_fail_on_bad_wrapping(po_file, capsys):
assert powrap.check_style([po_file]) == 1
assert str(po_file) in capsys.readouterr().err
@pytest.mark.parametrize("po_file", (FIXTURE_DIR / "good").glob("*.po"))
def test_succees_on_good_wrapping(po_file):
assert powrap.check_style([po_file]) == []
def test_succees_on_good_wrapping(po_file, capsys):
assert powrap.check_style([po_file]) == 0
assert str(po_file) not in capsys.readouterr().err
@pytest.mark.parametrize("po_file", (FIXTURE_DIR / "bad" / "invalid_po_file.po",))
def test_msgcat_error(po_file):
assert powrap.check_style([po_file]) == []
def test_msgcat_error(po_file, capsys):
assert powrap.check_style([po_file]) == 0
assert str(po_file) not in capsys.readouterr().err
@pytest.mark.parametrize("po_file", ("non_existent_file.po",))
def test_fileread_error(po_file):
assert powrap.check_style([po_file]) == []
def test_fileread_error(po_file, capsys):
assert powrap.check_style([po_file]) == 0
assert str(po_file) not in capsys.readouterr().err
@pytest.mark.parametrize("po_file", (FIXTURE_DIR / "good").glob("*.po"))
def test_wrong_msgcat(po_file):
""" test if msgcat is not available"""
"""Test if msgcat is not available"""
environ_saved = os.environ["PATH"]
os.environ["PATH"] = ""
with pytest.raises(SystemExit) as sysexit:

View File

@ -4,7 +4,7 @@ ignore = E203
max-line-length = 88
[tox]
envlist = py36, py37, py38, flake8, mypy, black
envlist = py36, py37, py38, py39, flake8, mypy, black, pydocstyle
isolated_build = False
skip_missing_interpreters = True
@ -26,3 +26,8 @@ commands = black --check --diff tests/ powrap/
[testenv:mypy]
deps = mypy
commands = mypy --ignore-missing-imports powrap/
[testenv:pydocstyle]
deps = pydocstyle
skip_install = True
commands = pydocstyle powrap/