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

Cleanup after removing Python 2 support #4607

Merged
merged 4 commits into from
Aug 13, 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
18 changes: 14 additions & 4 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ jobs:
# and are only run after the PR gets merged
GITHUB_TOKEN: ${{secrets.CI_UNIT_TESTS_GITHUB_TOKEN}}
run: |
# only install GitHub token when testing with Lmod 8.x + Python 3.6 or 3.9, to avoid hitting GitHub rate limit;
# only install GitHub token when testing with Lmod 8.x + Python 3.6 or 3.9, to avoid hitting GitHub rate limit
# tests that require a GitHub token are skipped automatically when no GitHub token is available
if [[ "${{matrix.modules_tool}}" =~ 'Lmod-8' ]] && [[ "${{matrix.python}}" =~ 3.[69] ]]; then
if [ ! -z $GITHUB_TOKEN ]; then
SET_KEYRING="import keyrings.alt.file; keyring.set_keyring(keyrings.alt.file.PlaintextKeyring())";
python -c "import keyring; $SET_KEYRING; keyring.set_password('github_token', 'easybuild_test', '$GITHUB_TOKEN')";
SET_KEYRING="import keyrings.alt.file; keyring.set_keyring(keyrings.alt.file.PlaintextKeyring())"
python -c "import keyring; $SET_KEYRING; keyring.set_password('github_token', 'easybuild_test', '$GITHUB_TOKEN')"
fi
echo "GitHub token installed!"
else
Expand Down Expand Up @@ -187,7 +187,17 @@ jobs:
# run test suite
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
# try and make sure output of running tests is clean (no printed messages/warnings)
IGNORE_PATTERNS="no GitHub token available|skipping SvnRepository test|requires Lmod as modules tool|stty: 'standard input': Inappropriate ioctl for device|CryptographyDeprecationWarning: Python 3.[56]|from cryptography.* import |CryptographyDeprecationWarning: Python 2|Blowfish|GC3Pie not available, skipping test|CryptographyDeprecationWarning: TripleDES has been moved|algorithms.TripleDES"
IGNORE_PATTERNS="no GitHub token available"
IGNORE_PATTERNS+="|skipping SvnRepository test"
IGNORE_PATTERNS+="|requires Lmod as modules tool"
IGNORE_PATTERNS+="|stty: 'standard input': Inappropriate ioctl for device"
IGNORE_PATTERNS+="|CryptographyDeprecationWarning: Python 3.[56]"
IGNORE_PATTERNS+="|from cryptography.* import "
IGNORE_PATTERNS+="|CryptographyDeprecationWarning: Python 2"
IGNORE_PATTERNS+="|Blowfish"
IGNORE_PATTERNS+="|GC3Pie not available, skipping test"
IGNORE_PATTERNS+="|CryptographyDeprecationWarning: TripleDES has been moved"
IGNORE_PATTERNS+="|algorithms.TripleDES"
# '|| true' is needed to avoid that GitHub Actions stops the job on non-zero exit of grep (i.e. when there are no matches)
PRINTED_MSG=$(egrep -v "${IGNORE_PATTERNS}" test_framework_suite.log | grep '\.\n*[A-Za-z]' || true)
test "x$PRINTED_MSG" = "x" || (echo "ERROR: Found printed messages in output of test suite" && echo "${PRINTED_MSG}" && exit 1)
Expand Down
2 changes: 1 addition & 1 deletion easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
import functools
import os
import re
from contextlib import contextmanager
from collections import OrderedDict
from contextlib import contextmanager

import easybuild.tools.filetools as filetools
from easybuild.base import fancylogger
Expand Down
1 change: 0 additions & 1 deletion easybuild/tools/py2vs3/py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import json
import sys
import urllib.request as std_urllib # noqa
from collections import OrderedDict # noqa
from collections.abc import Mapping # noqa
from functools import cmp_to_key
from importlib.util import spec_from_file_location, module_from_spec
Expand Down
1 change: 0 additions & 1 deletion easybuild/tools/systemtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,6 @@ def get_os_name():
# platform.linux_distribution was removed in Python 3.8,
# see https://docs.python.org/2/library/platform.html#platform.linux_distribution
if hasattr(platform, 'linux_distribution'):
# platform.linux_distribution is more useful, but only available since Python 2.6
# this allows to differentiate between Fedora, CentOS, RHEL and Scientific Linux (Rocks is just CentOS)
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=PendingDeprecationWarning)
Expand Down
22 changes: 0 additions & 22 deletions test/framework/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from easybuild.tools.filetools import read_file
from easybuild.tools.repository.filerepo import FileRepository
from easybuild.tools.repository.gitrepo import GitRepository
from easybuild.tools.repository.hgrepo import HgRepository
from easybuild.tools.repository.svnrepo import SvnRepository
from easybuild.tools.repository.repository import init_repository
from easybuild.tools.run import run_shell_cmd
Expand Down Expand Up @@ -129,27 +128,6 @@ def test_svnrepo(self):
self.assertExists(os.path.join(repo.wc, 'trunk', 'README.md'))
shutil.rmtree(repo.wc)

# this test is disabled because it fails in Travis as a result of bitbucket disabling TLS 1.0/1.1
# we can consider re-enabling it when moving to a more recent Ubuntu version in the Travis config
# (which implies dropping support for Python 2.6)
# cfr. https://github.com/easybuilders/easybuild-framework/pull/2678
def DISABLED_test_hgrepo(self):
"""Test using HgRepository."""
# only run this test if pysvn Python module is available
try:
import hglib # noqa
except ImportError:
print("(skipping HgRepository test)")
return

# GitHub also supports SVN
test_repo_url = 'https://kehoste@bitbucket.org/kehoste/testrepository'

repo = HgRepository(test_repo_url)
repo.init()
self.assertExists(os.path.join(repo.wc, 'README'))
shutil.rmtree(repo.wc)

def test_init_repository(self):
"""Test use of init_repository function."""
repo = init_repository('FileRepository', self.path)
Expand Down
Loading