Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

also run unit tests with Python 3.12 + add it to classifiers in setup.py #4484

Merged
merged 5 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/eb_command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
python: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -32,6 +32,10 @@ jobs:
# update to latest pip, check version
pip install --upgrade pip
pip --version
if ! python -c "import distutils" 2> /dev/null; then
# we need setuptools for distutils in Python 3.12+, needed for python setup.py sdist
pip install --upgrade setuptools
fi

# for modules tool
APT_PKGS="lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
modules_tool: ${{needs.setup.outputs.lmod8}}
- python: '3.11'
modules_tool: ${{needs.setup.outputs.lmod8}}
- python: '3.12'
modules_tool: ${{needs.setup.outputs.lmod8}}
# There may be encoding errors in Python 3 which are hidden when an UTF-8 encoding is set
# Hence run the tests (again) with LC_ALL=C and Python 3.6 (or any < 3.7)
- python: 3.6
Expand Down Expand Up @@ -83,6 +85,10 @@ jobs:
pip install --upgrade pip
pip --version
pip install -r requirements.txt
if ! python -c "import distutils" 2> /dev/null; then
# we need setuptools for distutils in Python 3.12+, needed for python setup.py sdist
pip install --upgrade setuptools
fi
# git config is required to make actual git commits (cfr. tests for GitRepository)
git config --global user.name "Travis CI"
git config --global user.email "travis@travis-ci.org"
Expand Down
8 changes: 6 additions & 2 deletions easybuild/tools/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import contextlib
import functools
import inspect
import locale
import os
import re
import signal
Expand Down Expand Up @@ -350,8 +351,11 @@ def to_cmd_str(cmd):
(stdout, stderr) = proc.communicate(input=stdin)

# return output as a regular string rather than a byte sequence (and non-UTF-8 characters get stripped out)
output = stdout.decode('utf-8', 'ignore')
stderr = stderr.decode('utf-8', 'ignore') if split_stderr else None
# getpreferredencoding normally gives 'utf-8' but can be ASCII (ANSI_X3.4-1968)
# for Python 3.6 and older with LC_ALL=C
encoding = locale.getpreferredencoding(False)
output = stdout.decode(encoding, 'ignore')
stderr = stderr.decode(encoding, 'ignore') if split_stderr else None

# store command output to temporary file(s)
if output_file:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def find_rel_test():
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Build Tools",
],
platforms="Linux",
Expand Down
4 changes: 2 additions & 2 deletions test/framework/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_run_cmd(self):
# this is constructed to reproduce errors like:
# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2
# UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018'
for text in [b"foo \xe2 bar", b"foo \u2018 bar"]:
for text in [b"foo \xe2 bar", "foo \u2018 bar"]:
test_file = os.path.join(self.test_prefix, 'foo.txt')
write_file(test_file, text)
cmd = "cat %s" % test_file
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_run_shell_cmd_basic(self):
# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2
# UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018'
# (such errors are ignored by the 'run' implementation)
for text in [b"foo \xe2 bar", b"foo \u2018 bar"]:
for text in [b"foo \xe2 bar", "foo \u2018 bar"]:
test_file = os.path.join(self.test_prefix, 'foo.txt')
write_file(test_file, text)
cmd = "cat %s" % test_file
Expand Down
Loading