Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spack_tuda
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Inghirami, Gabriele
spack_tuda
Commits
c97be2a9
Unverified
Commit
c97be2a9
authored
4 months ago
by
Harmen Stoppels
Committed by
GitHub
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
checksum.py tests: extract add_versions_to_pkg fixture (#49100)
parent
3fbdfc46
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/spack/spack/test/cmd/checksum.py
+11
-14
11 additions, 14 deletions
lib/spack/spack/test/cmd/checksum.py
with
11 additions
and
14 deletions
lib/spack/spack/test/cmd/checksum.py
+
11
−
14
View file @
c97be2a9
...
@@ -23,7 +23,15 @@
...
@@ -23,7 +23,15 @@
@pytest.fixture
@pytest.fixture
def
can_fetch_versions
(
monkeypatch
):
def
no_add
(
monkeypatch
):
def
add_versions_to_pkg
(
pkg
,
version_lines
,
open_in_editor
):
raise
AssertionError
(
"
Should not be called
"
)
monkeypatch
.
setattr
(
spack
.
cmd
.
checksum
,
"
add_versions_to_pkg
"
,
add_versions_to_pkg
)
@pytest.fixture
def
can_fetch_versions
(
monkeypatch
,
no_add
):
"""
Fake successful version detection.
"""
"""
Fake successful version detection.
"""
def
fetch_remote_versions
(
pkg
,
concurrency
):
def
fetch_remote_versions
(
pkg
,
concurrency
):
...
@@ -38,10 +46,6 @@ def get_checksums_for_versions(url_by_version, package_name, **kwargs):
...
@@ -38,10 +46,6 @@ def get_checksums_for_versions(url_by_version, package_name, **kwargs):
def
url_exists
(
url
,
curl
=
None
):
def
url_exists
(
url
,
curl
=
None
):
return
True
return
True
def
add_versions_to_pkg
(
pkg
,
version_lines
,
open_in_editor
):
raise
AssertionError
(
"
Should not be called
"
)
monkeypatch
.
setattr
(
spack
.
cmd
.
checksum
,
"
add_versions_to_pkg
"
,
add_versions_to_pkg
)
monkeypatch
.
setattr
(
monkeypatch
.
setattr
(
spack
.
package_base
.
PackageBase
,
"
fetch_remote_versions
"
,
fetch_remote_versions
spack
.
package_base
.
PackageBase
,
"
fetch_remote_versions
"
,
fetch_remote_versions
)
)
...
@@ -50,7 +54,7 @@ def add_versions_to_pkg(pkg, version_lines, open_in_editor):
...
@@ -50,7 +54,7 @@ def add_versions_to_pkg(pkg, version_lines, open_in_editor):
@pytest.fixture
@pytest.fixture
def
cannot_fetch_versions
(
monkeypatch
):
def
cannot_fetch_versions
(
monkeypatch
,
no_add
):
"""
Fake unsuccessful version detection.
"""
"""
Fake unsuccessful version detection.
"""
def
fetch_remote_versions
(
pkg
,
concurrency
):
def
fetch_remote_versions
(
pkg
,
concurrency
):
...
@@ -283,11 +287,7 @@ def test_checksum_versions(mock_packages, can_fetch_versions, monkeypatch):
...
@@ -283,11 +287,7 @@ def test_checksum_versions(mock_packages, can_fetch_versions, monkeypatch):
assert
"
version(
"
in
output
assert
"
version(
"
in
output
def
test_checksum_missing_version
(
mock_packages
,
cannot_fetch_versions
,
monkeypatch
):
def
test_checksum_missing_version
(
mock_packages
,
cannot_fetch_versions
):
def
add_versions_to_pkg
(
pkg
,
version_lines
,
open_in_editor
):
raise
AssertionError
(
"
Should not be called
"
)
monkeypatch
.
setattr
(
spack
.
cmd
.
checksum
,
"
add_versions_to_pkg
"
,
add_versions_to_pkg
)
output
=
spack_checksum
(
"
preferred-test
"
,
"
99.99.99
"
,
fail_on_error
=
False
)
output
=
spack_checksum
(
"
preferred-test
"
,
"
99.99.99
"
,
fail_on_error
=
False
)
assert
"
Could not find any remote versions
"
in
output
assert
"
Could not find any remote versions
"
in
output
output
=
spack_checksum
(
"
--add-to-package
"
,
"
preferred-test
"
,
"
99.99.99
"
,
fail_on_error
=
False
)
output
=
spack_checksum
(
"
--add-to-package
"
,
"
preferred-test
"
,
"
99.99.99
"
,
fail_on_error
=
False
)
...
@@ -295,9 +295,6 @@ def add_versions_to_pkg(pkg, version_lines, open_in_editor):
...
@@ -295,9 +295,6 @@ def add_versions_to_pkg(pkg, version_lines, open_in_editor):
def
test_checksum_deprecated_version
(
mock_packages
,
can_fetch_versions
):
def
test_checksum_deprecated_version
(
mock_packages
,
can_fetch_versions
):
def
add_versions_to_pkg
(
pkg
,
version_lines
,
open_in_editor
):
raise
AssertionError
(
"
Should not be called
"
)
output
=
spack_checksum
(
"
deprecated-versions
"
,
"
1.1.0
"
,
fail_on_error
=
False
)
output
=
spack_checksum
(
"
deprecated-versions
"
,
"
1.1.0
"
,
fail_on_error
=
False
)
assert
"
Version 1.1.0 is deprecated
"
in
output
assert
"
Version 1.1.0 is deprecated
"
in
output
output
=
spack_checksum
(
output
=
spack_checksum
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment