Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ 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.*default_backend|CryptographyDeprecationWarning: Python 2|from cryptography.utils import int_from_bytes|Blowfish|GC3Pie not available, skipping test"
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the "." in the "Python 3.[56]" should probably have a "" in front of it to be fully correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't touched that here.

# '|| true' is needed to avoid that Travis 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\n${PRINTED_MSG}" && exit 1)
test "x$PRINTED_MSG" = "x" || (echo "ERROR: Found printed messages in output of test suite" && echo "${PRINTED_MSG}" && exit 1)
2 changes: 1 addition & 1 deletion easybuild/toolchains/iimkl.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
* Kenneth Hoste (Ghent University)
* Bart Oldeman (McGill University, Calcul Quebec, Compute Canada)
"""
from distutils.version import LooseVersion
import re

from easybuild.toolchains.iccifort import IccIfort
from easybuild.toolchains.intel_compilers import IntelCompilersToolchain
from easybuild.toolchains.fft.intelfftw import IntelFFTW
from easybuild.toolchains.linalg.intelmkl import IntelMKL
from easybuild.tools import LooseVersion


class Iimkl(IccIfort, IntelCompilersToolchain, IntelMKL, IntelFFTW):
Expand Down
11 changes: 11 additions & 0 deletions easybuild/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,15 @@
"""
__path__ = __import__('pkgutil').extend_path(__path__, __name__)


import distutils.version
import warnings
from easybuild.tools.loose_version import LooseVersion # noqa(F401)


class StrictVersion(distutils.version.StrictVersion):
"""Temporary wrapper over distuitls StrictVersion that silences the deprecation warning"""
def __init__(self, *args, **kwargs):
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=DeprecationWarning)
distutils.version.StrictVersion.__init__(self, *args, **kwargs)
2 changes: 1 addition & 1 deletion easybuild/tools/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
import os
import re
import shlex
from distutils.version import StrictVersion

from easybuild.base import fancylogger
from easybuild.tools import StrictVersion
from easybuild.tools.build_log import EasyBuildError, print_warning
from easybuild.tools.config import ERROR, IGNORE, PURGE, UNLOAD, UNSET
from easybuild.tools.config import EBROOT_ENV_VAR_ACTIONS, LOADED_MODULES_ACTIONS
Expand Down
2 changes: 2 additions & 0 deletions test/framework/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import sys
import tempfile
import time
from test.framework.github import requires_github_access
from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered, init_config
from unittest import TextTestRunner
from easybuild.tools import run
Expand Down Expand Up @@ -2746,6 +2747,7 @@ def test_diff_files(self):
regex = re.compile(r'^--- .*/foo\s*\n\+\+\+ .*/bar\s*$', re.M)
self.assertTrue(regex.search(res), "Pattern '%s' found in: %s" % (regex.pattern, res))

@requires_github_access()
def test_get_source_tarball_from_git(self):
"""Test get_source_tarball_from_git function."""

Expand Down
20 changes: 20 additions & 0 deletions test/framework/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
@author: Kenneth Hoste (Ghent University)
"""
import base64
import functools
import os
import random
import re
import sys
import textwrap
import unittest
from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered, init_config
from time import gmtime
from unittest import TextTestRunner
Expand Down Expand Up @@ -69,6 +71,23 @@
GITHUB_BRANCH = 'main'


def requires_github_access():
"""Silently skip for pull requests unless $FORCE_EB_GITHUB_TESTS is set

Useful when the test uses e.g. `git` commands to download from Github and would run into rate limits
"""
if 'FORCE_EB_GITHUB_TESTS' in os.environ or os.getenv('GITHUB_EVENT_NAME') != 'pull_request':
return unittest.skipIf(False, None)
else:
# For pull requests silently skip to avoid rate limits
def decorator(test_item):
@functools.wraps(test_item)
def skip_wrapper(*args, **kwargs):
return
return skip_wrapper
return decorator


class GithubTest(EnhancedTestCase):
""" small test for The github package
This should not be to much, since there is an hourly limit of request
Expand Down Expand Up @@ -1038,6 +1057,7 @@ def test_github_det_pr_target_repo(self):
self.assertEqual(gh.det_pr_target_repo(categorize_files_by_type([configuremake])), 'thisisjustatest')
self.assertEqual(gh.det_pr_target_repo(categorize_files_by_type([toy_eb])), 'thisisjustatest')

@requires_github_access()
def test_push_branch_to_github(self):
"""Test push_branch_to_github."""

Expand Down
2 changes: 1 addition & 1 deletion test/framework/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
import shutil
import stat
import sys
from distutils.version import StrictVersion
from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered, init_config
from unittest import TextTestRunner

import easybuild.tools.modules as mod
from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig.easyconfig import EasyConfig
from easybuild.tools import StrictVersion
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.environment import modify_env
from easybuild.tools.filetools import adjust_permissions, copy_file, copy_dir, mkdir
Expand Down
3 changes: 1 addition & 2 deletions test/framework/modulestool.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@

from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered
from unittest import TextTestRunner
from distutils.version import StrictVersion

from easybuild.base import fancylogger
from easybuild.tools import modules
from easybuild.tools import modules, StrictVersion
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import read_file, which, write_file
from easybuild.tools.modules import Lmod
Expand Down
16 changes: 10 additions & 6 deletions test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import sys
import tempfile
import textwrap
import warnings
from easybuild.tools import LooseVersion
from unittest import TextTestRunner

Expand Down Expand Up @@ -6297,12 +6298,15 @@ def test_sort_looseversions(self):
else:
version_class = LooseVersion

ver1 = version_class('1.2.3')
ver2 = version_class('4.5.6')
ver3 = version_class('1.2.3dev')
ver4 = version_class('system')
ver5 = version_class('rc3')
ver6 = version_class('v1802')
with warnings.catch_warnings():
if use_distutils:
warnings.simplefilter("ignore", category=DeprecationWarning)
ver1 = version_class('1.2.3')
ver2 = version_class('4.5.6')
ver3 = version_class('1.2.3dev')
ver4 = version_class('system')
ver5 = version_class('rc3')
ver6 = version_class('v1802')

# some versions are included multiple times on purpose,
# to also test comparison between equal LooseVersion instances
Expand Down