2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 11:35:41 +00:00

Fixes to make compatible with Python 3.12 (#7112)

* Remove use of deprecated imp.load_source

The entire `imp` module has been removed from Python 3.12. This patch applies the recommended replacement using `importlib`.

* Fix usage of from importlib.metadata.entry_points to work with newer importlib & Python 3.12

* Update registry.py

Fix order of imports

* Use importlib.util.module_from_spec() instead of deprecated load_module()

* auto-fixed import style (isort)

* enable py 12

* run coverage for lower and upper bound

* fix style error

* make import conditional

* fix?

* fix env

* style fix

* only use new loader on 3.12

* fix order

* fix module loading

* reimplement assertDictContainsSubset

* remove old testing alias

---------

Co-authored-by: Thea Flowers <thea@winterbloom.com>
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
Matthias Mair
2024-04-29 12:59:24 +02:00
committed by GitHub
parent 477da1fa65
commit a205fd5967
4 changed files with 54 additions and 10 deletions

View File

@ -261,18 +261,22 @@ jobs:
coverage run -m unittest discover -s test/
coverage:
name: Tests - DB [SQLite] + Coverage
name: Tests - DB [SQLite] + Coverage ${{ matrix.python_version }}
runs-on: ubuntu-20.04
needs: ["pre-commit", "paths-filter"]
if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true'
continue-on-error: true # continue if a step fails so that coverage gets pushed
strategy:
matrix:
python_version: [3.9, 3.12]
env:
INVENTREE_DB_NAME: ./inventree.sqlite
INVENTREE_DB_ENGINE: sqlite3
INVENTREE_PLUGINS_ENABLED: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
python_version: ${{ matrix.python_version }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1