From 5d64204c133aba450d9bf8bd673ce4435d062c8d Mon Sep 17 00:00:00 2001 From: Oliver Bristow Date: Wed, 18 Jun 2025 12:03:17 +0100 Subject: [PATCH 1/2] chore: migrate to GitHub Actions --- .github/workflows/publish.yml | 23 +++++++++++++++++++++++ .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ .travis.yml | 29 ----------------------------- README.rst | 16 ++++------------ setup.py | 5 +++++ 5 files changed, 66 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f7cdd2b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,23 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Build package + run: | + python -m pip install --upgrade pip build + python -m build + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fb1c6e7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + +jobs: + test: + runs-on: ubuntu-22.04 + strategy: + matrix: + # the range of versions covered is much less than those claimed to be supported, just + # because it would take getting hands on for CI to cover the old versions that Travis + # previously covered, back when those versions were contemporary. + python-version: ["3.7", "3.13", "3.14-dev"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install . pytest pytest-cov + - name: Run tests + run: | + pytest -vv --cov=jsonstore + - name: Upload coverage + uses: actions/upload-artifact@v4 + with: + name: coverage-${{ matrix.python-version }} + path: .coverage diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 534b5a6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: python - -jobs: - include: - - python: 3.9 - - python: 3.8 - - python: 3.7 - - python: 3.6 - - python: 3.5 - - python: 3.4 - - python: 2.7 - - python: pypy3 - - python: pypy - - name: "Python: 2.7" - os: osx - osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.4 - language: shell # 'language: python' is an error on Travis CI macOS - - name: "Python: 3.8" - os: windows # Windows 10.0.17134 N/A Build 17134 - language: shell # 'language: python' is an error on Travis CI Windows - before_install: - - choco install python --version 3.8.2 - - python -m pip install --upgrade pip - env: PATH=/c/Python38:/c/Python38/Scripts:$PATH - -install: python -m pip install --upgrade . pytest==4.6.1 pytest-cov==2.8.1 codecov==2.1.10 -script: python -m pytest -vv --cov=jsonstore --cov-append -after_success: - - codecov diff --git a/README.rst b/README.rst index 361523e..b8bfa19 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -|PyPi Package| |Build Status| |Codacy Rating| |Coverage Report| +|PyPi Package| jsonstore ========= @@ -12,11 +12,8 @@ flexible than the `configparser `__ module which is included with Python. -This works is tested and working on Python 2.7+ and Python 3.3+. It will -not work on 2.6 or lower, but is expected to work on 3.0-3.2. The tests -do not work in 3.2.6 due to -`mistreating `__ -the 💩 when parsing the test code. This is also tested on pypy and pypy3. +This works is tested and working on Python 2.7 and Python 3.6+. It will +not work on 2.6 or lower. The tests are also executed on PyPy. Examples -------- @@ -110,11 +107,6 @@ file until all of the transactions have been closed. # here we see the value that was saved previously assert store.value == 1 -.. |Build Status| image:: https://travis-ci.org/Code0x58/python-jsonstore.svg?branch=master - :target: https://travis-ci.org/Code0x58/python-jsonstore -.. |Codacy Rating| image:: https://api.codacy.com/project/badge/Grade/37ea488773444de59469a3775be83faf - :target: https://www.codacy.com/app/evilumbrella-github/python-jsonstore?utm_source=github.com&utm_medium=referral&utm_content=Code0x58/python-jsonstore&utm_campaign=Badge_Grade + .. |PyPi Package| image:: https://badge.fury.io/py/python-jsonstore.svg :target: https://pypi.org/project/python-jsonstore/ -.. |Coverage Report| image:: https://codecov.io/gh/Code0x58/python-jsonstore/branch/master/graph/badge.svg - :target: https://codecov.io/gh/Code0x58/python-jsonstore \ No newline at end of file diff --git a/setup.py b/setup.py index f71b9ac..6aadfcd 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,11 @@ Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 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 + Programming Language :: Python :: 3.13 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy Topic :: Database From ed3dc5e7a2fa8343f585eb5123556e530447307e Mon Sep 17 00:00:00 2001 From: Oliver Bristow Date: Wed, 18 Jun 2025 16:34:53 +0100 Subject: [PATCH 2/2] Accept that some python version after 3.9 raises a KeyError instead of TypeError in test case --- test_jsonstore.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_jsonstore.py b/test_jsonstore.py index 5a51c85..476f2a1 100644 --- a/test_jsonstore.py +++ b/test_jsonstore.py @@ -216,7 +216,8 @@ def test_del(self): del self.store["list", 1] self.store.dict = {} - with self.assertRaises(TypeError): + # somewhere after python 3.9 this went from a TypeError to a KeyError + with self.assertRaises((TypeError, KeyError)): del self.store["dict", slice("a")] def test_context_and_deserialisation(self):