summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-03-16 16:16:31 +0100
committerGitHub <noreply@github.com>2021-03-16 08:16:31 -0700
commitb304b4bdb0f703569b76696c219670bd2d5dc680 (patch)
tree16e58d2724f3b29185dfa429bbbc35b3dfef9651 /lib
parentd36de79ba02252ae3279832e85d9f056af475b11 (diff)
downloadspack-b304b4bdb0f703569b76696c219670bd2d5dc680.tar.gz
spack-b304b4bdb0f703569b76696c219670bd2d5dc680.tar.bz2
spack-b304b4bdb0f703569b76696c219670bd2d5dc680.tar.xz
spack-b304b4bdb0f703569b76696c219670bd2d5dc680.zip
Speed-up CI by reorganizing tests (#22247)
* unit tests: mark slow tests as "maybeslow" This commit also removes the "network" marker and marks every "network" test as "maybeslow". Tests marked as db are maintained, but they're not slow anymore. * GA: require style tests to pass before running unit-tests * GA: make MacOS unit tests fail fast * GA: move all unit tests into the same workflow, run style tests as a prerequisite All the unit tests have been moved into the same workflow so that a single run of the dorny/paths-filter action can be used to ask for coverage based on the files that have been changed in a PR. The basic idea is that for PRs that introduce only changes to packages coverage is not necessary, this resulting in a faster execution of the tests. Also, for package only PRs slow unit tests are skipped. Finally, MacOS and linux unit tests are now conditional on style tests passing meaning that e.g. we won't waste a MacOS worker if we know that the PR has flake8 issues. * Addressed review comments * Skipping slow tests on MacOS for package only recipes * QA: make tests on changes correct before merging
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/ci.py1
-rw-r--r--lib/spack/spack/test/cmd/ci.py3
-rw-r--r--lib/spack/spack/test/cmd/env.py6
-rw-r--r--lib/spack/spack/test/cmd/url.py4
-rw-r--r--lib/spack/spack/test/cmd/versions.py15
-rw-r--r--lib/spack/spack/test/util/util_gpg.py1
6 files changed, 18 insertions, 12 deletions
diff --git a/lib/spack/spack/test/ci.py b/lib/spack/spack/test/ci.py
index 33488a2d8a..dae5066bf8 100644
--- a/lib/spack/spack/test/ci.py
+++ b/lib/spack/spack/test/ci.py
@@ -114,6 +114,7 @@ def test_get_concrete_specs(config, mock_packages):
assert('archive-files' in spec_map)
+@pytest.mark.maybeslow
def test_register_cdash_build():
build_name = 'Some pkg'
base_url = 'http://cdash.fake.org'
diff --git a/lib/spack/spack/test/cmd/ci.py b/lib/spack/spack/test/cmd/ci.py
index 24992d78c2..927c1e9ce8 100644
--- a/lib/spack/spack/test/cmd/ci.py
+++ b/lib/spack/spack/test/cmd/ci.py
@@ -38,6 +38,9 @@ buildcache_cmd = spack.main.SpackCommand('buildcache')
git = exe.which('git', required=True)
+pytestmark = pytest.mark.maybeslow
+
+
@pytest.fixture()
def env_deactivate():
yield
diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py
index 592d8f451c..5665b41fac 100644
--- a/lib/spack/spack/test/cmd/env.py
+++ b/lib/spack/spack/test/cmd/env.py
@@ -25,8 +25,10 @@ from spack.util.path import substitute_path_variables
# everything here uses the mock_env_path
-pytestmark = pytest.mark.usefixtures(
- 'mutable_mock_env_path', 'config', 'mutable_mock_repo')
+pytestmark = [
+ pytest.mark.usefixtures('mutable_mock_env_path', 'config', 'mutable_mock_repo'),
+ pytest.mark.maybeslow
+]
env = SpackCommand('env')
install = SpackCommand('install')
diff --git a/lib/spack/spack/test/cmd/url.py b/lib/spack/spack/test/cmd/url.py
index f2466dcdf2..c130840984 100644
--- a/lib/spack/spack/test/cmd/url.py
+++ b/lib/spack/spack/test/cmd/url.py
@@ -71,7 +71,7 @@ def test_url_with_no_version_fails():
url('parse', 'http://www.netlib.org/voronoi/triangle.zip')
-@pytest.mark.network
+@pytest.mark.maybeslow
@pytest.mark.skipif(
sys.version_info < (2, 7),
reason="Python 2.6 tests are run in a container, where "
@@ -106,7 +106,7 @@ def test_url_list():
assert 0 < correct_version_urls < total_urls
-@pytest.mark.network
+@pytest.mark.maybeslow
@pytest.mark.skipif(
sys.version_info < (2, 7),
reason="Python 2.6 tests are run in a container, where "
diff --git a/lib/spack/spack/test/cmd/versions.py b/lib/spack/spack/test/cmd/versions.py
index e4bf711a8a..0d6f53833c 100644
--- a/lib/spack/spack/test/cmd/versions.py
+++ b/lib/spack/spack/test/cmd/versions.py
@@ -14,7 +14,6 @@ def test_safe_only_versions():
"""Only test the safe versions of a package.
(Using the deprecated command line argument)
"""
-
versions('--safe-only', 'zlib')
@@ -24,21 +23,21 @@ def test_safe_versions():
versions('--safe', 'zlib')
-@pytest.mark.network
+@pytest.mark.maybeslow
def test_remote_versions():
"""Test a package for which remote versions should be available."""
versions('zlib')
-@pytest.mark.network
+@pytest.mark.maybeslow
def test_remote_versions_only():
"""Test a package for which remote versions should be available."""
versions('--remote', 'zlib')
-@pytest.mark.network
+@pytest.mark.maybeslow
@pytest.mark.usefixtures('mock_packages')
def test_new_versions_only():
"""Test a package for which new versions should be available."""
@@ -46,28 +45,28 @@ def test_new_versions_only():
versions('--new', 'brillig')
-@pytest.mark.network
+@pytest.mark.maybeslow
def test_no_versions():
"""Test a package for which no remote versions are available."""
versions('converge')
-@pytest.mark.network
+@pytest.mark.maybeslow
def test_no_unchecksummed_versions():
"""Test a package for which no unchecksummed versions are available."""
versions('bzip2')
-@pytest.mark.network
+@pytest.mark.maybeslow
def test_versions_no_url():
"""Test a package with versions but without a ``url`` attribute."""
versions('graphviz')
-@pytest.mark.network
+@pytest.mark.maybeslow
def test_no_versions_no_url():
"""Test a package without versions or a ``url`` attribute."""
diff --git a/lib/spack/spack/test/util/util_gpg.py b/lib/spack/spack/test/util/util_gpg.py
index b8adbc537d..987dcf7f0e 100644
--- a/lib/spack/spack/test/util/util_gpg.py
+++ b/lib/spack/spack/test/util/util_gpg.py
@@ -65,6 +65,7 @@ fpr:::::::::ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ:"""
@pytest.mark.skipif(not spack.util.gpg.GpgConstants.user_run_dir,
reason='This test requires /var/run/user/$(id -u)')
+@pytest.mark.requires_executables('gpg2')
def test_really_long_gnupg_home_dir(tmpdir):
N = 960