Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mpsd-software-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MPSD Computational Science
mpsd-software-manager
Commits
dfdbf1be
Commit
dfdbf1be
authored
1 year ago
by
Ashwin Kumar Karnad
Browse files
Options
Downloads
Patches
Plain Diff
add test for remove environment
parent
1fbc5d7d
Branches
Branches containing commit
No related tags found
1 merge request
!57
Try remove cmd
Pipeline
#371721
failed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mpsd-software.py
+15
-3
15 additions, 3 deletions
mpsd-software.py
test_mpsd-software.py
+24
-0
24 additions, 0 deletions
test_mpsd-software.py
with
39 additions
and
3 deletions
mpsd-software.py
+
15
−
3
View file @
dfdbf1be
...
...
@@ -15,6 +15,7 @@ import time
from
pathlib
import
Path
from
typing
import
List
,
Tuple
,
Union
import
re
import
shutil
# If 'rich' is available ("pip install rich" or "apt-get install python3-rich"),
# then use coloured output, otherwise proceed as before
...
...
@@ -984,9 +985,20 @@ def remove_environment(release, package_sets, target_dir):
msg
=
(
f
"
Removing release
{
release
}
with package_sets
{
package_sets
}
from
{
target_dir
}
"
)
logging
.
info
(
msg
)
raise
NotImplementedError
(
msg
)
logging
.
warning
(
msg
)
if
toolchains
==
"
NONE
"
:
logging
.
warning
(
"
Please specify toolchains to remove, or
'
ALL
'
to remove all toolchains
"
)
sys
.
exit
(
1
)
if
"
ALL
"
in
toolchains
:
# we need to remove the entire release folder
logging
.
info
(
f
"
Removing release
{
mpsd_release
}
from
{
root_dir
}
"
"
do you want to continue? [y/n]
"
)
if
not
force
or
input
().
lower
()
==
"
y
"
:
shutil
.
rmtree
(
root_dir
/
mpsd_release
)
def
start_new_environment
(
release
,
from_release
,
target_dir
):
"""
Start new MPSD software environment version.
"""
...
...
This diff is collapsed.
Click to expand it.
test_mpsd-software.py
+
24
−
0
View file @
dfdbf1be
...
...
@@ -464,6 +464,8 @@ def create_fake_environment(tmp_path, mpsd_release, expected_toolchain_map=None)
toolchain_lua_file
.
touch
()
return
expected_toolchain_map
def
test_environment_status
(
tmp_path
):
"""
Test that the environment status is correct.
"""
toolchain_map
=
mod
.
environment_status
(
"
fake-release
"
,
tmp_path
)
...
...
@@ -477,6 +479,28 @@ def test_environment_status(tmp_path):
assert
set
(
toolchain_map
[
microarch
])
==
set
(
expected_toolchain_map
[
microarch
])
def
test_remove_environment
(
tmp_path
):
"""
Test that the remove_environment works as expected.
"""
mpsd_release
=
"
dev-23a
"
# create a fake environment
create_fake_environment
(
tmp_path
,
mpsd_release
)
# check that the environment status is correct
toolchain_map
=
mod
.
environment_status
(
mpsd_release
,
tmp_path
)
assert
toolchain_map
is
not
None
# test removal without arguments (should sys.exit(1))
create_fake_environment
(
tmp_path
,
mpsd_release
)
with
pytest
.
raises
(
SystemExit
):
mod
.
remove_environment
(
mpsd_release
,
tmp_path
,
force
=
True
)
# test removal of the complete environment
mod
.
remove_environment
(
mpsd_release
,
tmp_path
,
[
"
ALL
"
])
toolchain_map
=
mod
.
environment_status
(
mpsd_release
,
tmp_path
)
assert
toolchain_map
is
None
# test removal of a single toolchain
def
test_interface
(
tmp_path
):
"""
Test other things (not implemented yet).
"""
pass
...
...
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