Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eic_tools
Spack
Commits
fa0a5e44
Commit
fa0a5e44
authored
5 years ago
by
Massimiliano Culpo
Committed by
Todd Gamblin
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Correct pytest.raises matches to match (#15346)
parent
5406e1f4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/spack/spack/test/database.py
+1
-1
1 addition, 1 deletion
lib/spack/spack/test/database.py
lib/spack/spack/test/installer.py
+7
-7
7 additions, 7 deletions
lib/spack/spack/test/installer.py
lib/spack/spack/test/llnl/util/lock.py
+2
-2
2 additions, 2 deletions
lib/spack/spack/test/llnl/util/lock.py
with
10 additions
and
10 deletions
lib/spack/spack/test/database.py
+
1
−
1
View file @
fa0a5e44
...
...
@@ -755,7 +755,7 @@ def test_query_spec_with_non_conditional_virtual_dependency(database):
def
test_failed_spec_path_error
(
database
):
"""
Ensure spec not concrete check is covered.
"""
s
=
spack
.
spec
.
Spec
(
'
a
'
)
with
pytest
.
raises
(
ValueError
,
match
es
=
'
Concrete spec required
'
):
with
pytest
.
raises
(
ValueError
,
match
=
'
Concrete spec required
'
):
spack
.
store
.
db
.
_failed_spec_path
(
s
)
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/test/installer.py
+
7
−
7
View file @
fa0a5e44
...
...
@@ -245,7 +245,7 @@ def test_ensure_locked_have(install_mockery, tmpdir):
def
test_package_id
(
install_mockery
):
"""
Test to cover package_id functionality.
"""
pkg
=
spack
.
repo
.
get
(
'
trivial-install-test-package
'
)
with
pytest
.
raises
(
ValueError
,
match
es
=
'
spec is not concretized
'
):
with
pytest
.
raises
(
ValueError
,
match
=
'
spec is not concretized
'
):
inst
.
package_id
(
pkg
)
spec
=
spack
.
spec
.
Spec
(
'
trivial-install-test-package
'
)
...
...
@@ -280,7 +280,7 @@ def _no_compilers(pkg, arch_spec):
# Test up to the dependency check
monkeypatch
.
setattr
(
spack
.
compilers
,
'
compilers_for_spec
'
,
_no_compilers
)
with
pytest
.
raises
(
spack
.
repo
.
UnknownPackageError
,
match
es
=
'
not found
'
):
with
pytest
.
raises
(
spack
.
repo
.
UnknownPackageError
,
match
=
'
not found
'
):
inst
.
_packages_needed_to_bootstrap_compiler
(
spec
.
package
)
...
...
@@ -300,7 +300,7 @@ def test_check_deps_status_errs(install_mockery, monkeypatch):
orig_fn
=
spack
.
database
.
Database
.
prefix_failed
monkeypatch
.
setattr
(
spack
.
database
.
Database
,
'
prefix_failed
'
,
_true
)
with
pytest
.
raises
(
inst
.
InstallError
,
match
es
=
'
install failure
'
):
with
pytest
.
raises
(
inst
.
InstallError
,
match
=
'
install failure
'
):
installer
.
_check_deps_status
()
monkeypatch
.
setattr
(
spack
.
database
.
Database
,
'
prefix_failed
'
,
orig_fn
)
...
...
@@ -308,7 +308,7 @@ def test_check_deps_status_errs(install_mockery, monkeypatch):
# Ensure do not acquire the lock
monkeypatch
.
setattr
(
inst
.
PackageInstaller
,
'
_ensure_locked
'
,
_not_locked
)
with
pytest
.
raises
(
inst
.
InstallError
,
match
es
=
'
write locked by another
'
):
with
pytest
.
raises
(
inst
.
InstallError
,
match
=
'
write locked by another
'
):
installer
.
_check_deps_status
()
...
...
@@ -485,7 +485,7 @@ def test_install_uninstalled_deps(install_mockery, monkeypatch, capsys):
monkeypatch
.
setattr
(
inst
.
PackageInstaller
,
'
_update_failed
'
,
_noop
)
msg
=
'
Cannot proceed with dependent-install
'
with
pytest
.
raises
(
spack
.
installer
.
InstallError
,
match
es
=
msg
):
with
pytest
.
raises
(
spack
.
installer
.
InstallError
,
match
=
msg
):
installer
.
install
()
out
=
str
(
capsys
.
readouterr
())
...
...
@@ -503,7 +503,7 @@ def test_install_failed(install_mockery, monkeypatch, capsys):
monkeypatch
.
setattr
(
inst
.
PackageInstaller
,
'
_install_task
'
,
_noop
)
msg
=
'
Installation of b failed
'
with
pytest
.
raises
(
spack
.
installer
.
InstallError
,
match
es
=
msg
):
with
pytest
.
raises
(
spack
.
installer
.
InstallError
,
match
=
msg
):
installer
.
install
()
out
=
str
(
capsys
.
readouterr
())
...
...
@@ -622,7 +622,7 @@ def _install(installer, task, **kwargs):
spec
,
installer
=
create_installer
(
'
b
'
)
with
pytest
.
raises
(
dl
.
InstallDirectoryAlreadyExistsError
,
match
es
=
err
):
with
pytest
.
raises
(
dl
.
InstallDirectoryAlreadyExistsError
,
match
=
err
):
installer
.
install
()
assert
'
b
'
in
installer
.
installed
This diff is collapsed.
Click to expand it.
lib/spack/spack/test/llnl/util/lock.py
+
2
−
2
View file @
fa0a5e44
...
...
@@ -1272,7 +1272,7 @@ def test_downgrade_write_fails(tmpdir):
lock
=
lk
.
Lock
(
'
lockfile
'
)
lock
.
acquire_read
()
msg
=
'
Cannot downgrade lock from write to read on file: lockfile
'
with
pytest
.
raises
(
lk
.
LockDowngradeError
,
match
es
=
msg
):
with
pytest
.
raises
(
lk
.
LockDowngradeError
,
match
=
msg
):
lock
.
downgrade_write_to_read
()
...
...
@@ -1292,5 +1292,5 @@ def test_upgrade_read_fails(tmpdir):
lock
=
lk
.
Lock
(
'
lockfile
'
)
lock
.
acquire_write
()
msg
=
'
Cannot upgrade lock from read to write on file: lockfile
'
with
pytest
.
raises
(
lk
.
LockUpgradeError
,
match
es
=
msg
):
with
pytest
.
raises
(
lk
.
LockUpgradeError
,
match
=
msg
):
lock
.
upgrade_read_to_write
()
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