From b08cdb8dbb7c26874d7d42123b8e527bf2e598f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Goc=C5=82awski?= Date: Fri, 12 Jul 2024 11:59:37 +0200 Subject: [PATCH] Switch to running tests with GitHub Actions. Update supported Python versions. --- .github/workflows/python.yml | 23 +++++++++++++++++++++++ .travis.yml | 17 ----------------- setup.cfg | 9 +++++++-- setup.py | 4 +--- tox.ini | 18 ++++++++++++++++++ 5 files changed, 49 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/python.yml delete mode 100644 .travis.yml create mode 100644 tox.ini diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000..55b557f --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,23 @@ +name: CI +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install tox and any other packages + run: pip install tox + - name: Run tox + run: tox run -e lint,py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4654005..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -dist: jammy -language: python -python: - - 3.8 - - 3.9 - - 3.10 - - 3.11 -install: - - pip install -r base_requirements.txt - - pip install -U setuptools - - pip install -U pytest pytest-cov coveralls flake8 - - pip install flask -script: - - flake8 . - - python -m pytest --cov . -after_success: - - coveralls diff --git a/setup.cfg b/setup.cfg index 817a67a..bab6c65 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,13 @@ [zest.releaser] create-wheel = yes -[aliases] -test=pytest +[bdist_wheel] +universal = 1 [flake8] max-line-length = 120 + +[isort] +force_single_line = true +line_length = 120 +lines_between_types = 1 diff --git a/setup.py b/setup.py index 4662cbc..99af39f 100644 --- a/setup.py +++ b/setup.py @@ -23,8 +23,6 @@ def get_long_description(): url='https://github.com/socialwifi/jsonapi-requests', packages=find_packages(exclude=['tests']), install_requires=parse_requirements('base_requirements.txt'), - setup_requires=['pytest-runner'], - tests_require=['pytest', 'flask'], extras_require={ 'flask': ['flask'] }, @@ -37,9 +35,9 @@ def get_long_description(): 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ] ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..9fb6673 --- /dev/null +++ b/tox.ini @@ -0,0 +1,18 @@ +[tox] +requires = tox>=4 +env_list = lint, py{39,310,311,312} + +[testenv] +description = run unit tests +deps = + flask + pytest +commands = pytest . + +[testenv:lint] +description = run linters +skip_install = true +deps = + flake8 +commands = + flake8