Skip to content

Commit

Permalink
Fix syntax error in Python 3.12 (#852)
Browse files Browse the repository at this point in the history
* update hide_modules.py to work with Python 3.12
* add Python 3.11 and 3.12 to CI tests
* adapt version test to allow Python dev version

---------

Co-authored-by: mrbean-bremen <[email protected]>
  • Loading branch information
alcir and mrbean-bremen authored Jul 20, 2023
1 parent a5beba7 commit 1511488
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/merge-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand All @@ -39,7 +39,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog/v2.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ Enhancements

Changes
.......

* Add preliminary support for Python 3.12
11 changes: 2 additions & 9 deletions pynetdicom/tests/hide_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,10 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

try:
import importlib.abc
from importlib.abc import MetaPathFinder

# py>=3.3 has MetaPathFinder
_ModuleHiderBase = getattr(importlib.abc, "MetaPathFinder", importlib.abc.Finder)
except ImportError:
# py2
_ModuleHiderBase = object


class ModuleHider(_ModuleHiderBase):
class ModuleHider(MetaPathFinder):
"""Import finder hook to hide specified modules
ModuleHider(hidden_modules) -> instance
hidden_modules is a list of strings naming modules to hide.
Expand Down
2 changes: 2 additions & 0 deletions pynetdicom/tests/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def test_python_version(self):
if not version:
raise RuntimeError("No 'PYTHON_VERSION' envar has been set")

# remove any pre-release suffix
version = version.split("-")[0]
version = tuple([int(vv) for vv in version.split(".")])
assert version[:2] == sys.version_info[:2]

Expand Down

0 comments on commit 1511488

Please sign in to comment.