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
72c9604b
Commit
72c9604b
authored
9 years ago
by
Todd Gamblin
Browse files
Options
Downloads
Patches
Plain Diff
Small fix to prevent this test from interfering with others.
parent
55662eca
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/spack/spack/test/unit_install.py
+22
-17
22 additions, 17 deletions
lib/spack/spack/test/unit_install.py
with
22 additions
and
17 deletions
lib/spack/spack/test/unit_install.py
+
22
−
17
View file @
72c9604b
...
@@ -26,16 +26,16 @@
...
@@ -26,16 +26,16 @@
import
itertools
import
itertools
import
spack
import
spack
test_install
=
__import__
(
"
spack.cmd.test-install
"
,
test_install
=
__import__
(
"
spack.cmd.test-install
"
,
fromlist
=
[
"
BuildId
"
,
"
create_test_output
"
,
"
TestResult
"
])
fromlist
=
[
"
BuildId
"
,
"
create_test_output
"
,
"
TestResult
"
])
class
MockOutput
(
object
):
class
MockOutput
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
results
=
{}
self
.
results
=
{}
def
add_test
(
self
,
buildId
,
passed
=
True
,
buildInfo
=
None
):
def
add_test
(
self
,
buildId
,
passed
=
True
,
buildInfo
=
None
):
self
.
results
[
buildId
]
=
passed
self
.
results
[
buildId
]
=
passed
def
write_to
(
self
,
stream
):
def
write_to
(
self
,
stream
):
pass
pass
...
@@ -45,14 +45,14 @@ def __init__(self, name, version, hashStr=None):
...
@@ -45,14 +45,14 @@ def __init__(self, name, version, hashStr=None):
self
.
name
=
name
self
.
name
=
name
self
.
version
=
version
self
.
version
=
version
self
.
hash
=
hashStr
if
hashStr
else
hash
((
name
,
version
))
self
.
hash
=
hashStr
if
hashStr
else
hash
((
name
,
version
))
def
traverse
(
self
,
order
=
None
):
def
traverse
(
self
,
order
=
None
):
allDeps
=
itertools
.
chain
.
from_iterable
(
i
.
traverse
()
for
i
in
allDeps
=
itertools
.
chain
.
from_iterable
(
i
.
traverse
()
for
i
in
self
.
dependencies
.
itervalues
())
self
.
dependencies
.
itervalues
())
return
set
(
itertools
.
chain
([
self
],
allDeps
))
return
set
(
itertools
.
chain
([
self
],
allDeps
))
def
dag_hash
(
self
):
def
dag_hash
(
self
):
return
self
.
hash
return
self
.
hash
def
to_yaml
(
self
):
def
to_yaml
(
self
):
return
"
<<<MOCK YAML {0}>>>
"
.
format
(
test_install
.
BuildId
(
self
).
stringId
())
return
"
<<<MOCK YAML {0}>>>
"
.
format
(
test_install
.
BuildId
(
self
).
stringId
())
...
@@ -75,47 +75,52 @@ class UnitInstallTest(unittest.TestCase):
...
@@ -75,47 +75,52 @@ class UnitInstallTest(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
UnitInstallTest
,
self
).
setUp
()
super
(
UnitInstallTest
,
self
).
setUp
()
pkgX
.
installed
=
False
pkgX
.
installed
=
False
pkgY
.
installed
=
False
pkgY
.
installed
=
False
self
.
saved_db
=
spack
.
db
pkgDb
=
MockPackageDb
({
specX
:
pkgX
,
specY
:
pkgY
})
pkgDb
=
MockPackageDb
({
specX
:
pkgX
,
specY
:
pkgY
})
spack
.
db
=
pkgDb
spack
.
db
=
pkgDb
def
tearDown
(
self
):
def
tearDown
(
self
):
super
(
UnitInstallTest
,
self
).
tearDown
()
super
(
UnitInstallTest
,
self
).
tearDown
()
spack
.
db
=
self
.
saved_db
def
test_installing_both
(
self
):
def
test_installing_both
(
self
):
mo
=
MockOutput
()
mo
=
MockOutput
()
pkgX
.
installed
=
True
pkgX
.
installed
=
True
pkgY
.
installed
=
True
pkgY
.
installed
=
True
test_install
.
create_test_output
(
specX
,
[
specX
,
specY
],
mo
,
getLogFunc
=
test_fetch_log
)
test_install
.
create_test_output
(
specX
,
[
specX
,
specY
],
mo
,
getLogFunc
=
test_fetch_log
)
self
.
assertEqual
(
mo
.
results
,
self
.
assertEqual
(
mo
.
results
,
{
bIdX
:
test_install
.
TestResult
.
PASSED
,
{
bIdX
:
test_install
.
TestResult
.
PASSED
,
bIdY
:
test_install
.
TestResult
.
PASSED
})
bIdY
:
test_install
.
TestResult
.
PASSED
})
def
test_dependency_already_installed
(
self
):
def
test_dependency_already_installed
(
self
):
mo
=
MockOutput
()
mo
=
MockOutput
()
pkgX
.
installed
=
True
pkgX
.
installed
=
True
pkgY
.
installed
=
True
pkgY
.
installed
=
True
test_install
.
create_test_output
(
specX
,
[
specX
],
mo
,
getLogFunc
=
test_fetch_log
)
test_install
.
create_test_output
(
specX
,
[
specX
],
mo
,
getLogFunc
=
test_fetch_log
)
self
.
assertEqual
(
mo
.
results
,
{
bIdX
:
test_install
.
TestResult
.
PASSED
})
self
.
assertEqual
(
mo
.
results
,
{
bIdX
:
test_install
.
TestResult
.
PASSED
})
#TODO: add test(s) where Y fails to install
#TODO: add test(s) where Y fails to install
class
MockPackageDb
(
object
):
class
MockPackageDb
(
object
):
def
__init__
(
self
,
init
=
None
):
def
__init__
(
self
,
init
=
None
):
self
.
specToPkg
=
{}
self
.
specToPkg
=
{}
if
init
:
if
init
:
self
.
specToPkg
.
update
(
init
)
self
.
specToPkg
.
update
(
init
)
def
get
(
self
,
spec
):
def
get
(
self
,
spec
):
return
self
.
specToPkg
[
spec
]
return
self
.
specToPkg
[
spec
]
def
test_fetch_log
(
path
):
def
test_fetch_log
(
path
):
return
[]
return
[]
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