Skip to content
Snippets Groups Projects
Commit 4ac0a230 authored by Adrian Ciu's avatar Adrian Ciu
Browse files

esd-spack-installation: added clean up after each test

parent a6c7030f
No related branches found
No related tags found
1 merge request!4feat(spack_operation): implement setup_spack_env functionality
Pipeline #58787 passed with stages
in 2 minutes and 52 seconds
# ~~Yashchiki~~Koutakia
For now, this repository provides helpers for the EBRAINS container image build flow.
The lowest spack version which should be used with this library is v0.22.0
......@@ -12,24 +12,24 @@ def test_spack_repo_exists_1():
assert spack_manager.spack_repo_exists('ebrains-spack-builds') == False
def test_spack_repo_exists_2():
install_dir = Path('./install').resolve()
def test_spack_repo_exists_2(tmp_path):
install_dir = tmp_path
env = SpackModel('ebrains-spack-builds', install_dir)
spack_manager = SpackManagerScratch(env=env)
with pytest.raises(NoSpackEnvironmentException):
spack_manager.spack_repo_exists(env.env_name)
# def test_spack_repo_exists_3():
# install_dir = Path('./install').resolve()
# env = SpackModel('ebrains-spack-builds', install_dir)
# spack_manager = SpackManagerScratch(env=env)
# spack_manager.setup_spack_env()
# assert spack_manager.spack_repo_exists(env.env_name) == False
def test_spack_repo_exists_3(tmp_path):
install_dir = tmp_path
env = SpackModel('ebrains-spack-builds', install_dir)
spack_manager = SpackManagerScratch(env=env)
spack_manager.setup_spack_env()
assert spack_manager.spack_repo_exists(env.env_name) == False
def test_spack_from_scratch_setup_1():
install_dir = Path('./install').resolve()
def test_spack_from_scratch_setup_1(tmp_path):
install_dir = tmp_path
env = SpackModel('ebrains-spack-builds', install_dir,
'https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/ebrains-spack-builds.git', )
spack_manager = SpackManagerScratch(env=env, repos=[env], system_name='ebrainslab')
......@@ -37,8 +37,8 @@ def test_spack_from_scratch_setup_1():
assert spack_manager.spack_repo_exists(env.env_name) == True
def test_spack_from_scratch_setup_2():
install_dir = Path('./install').resolve()
def test_spack_from_scratch_setup_2(tmp_path):
install_dir = tmp_path
env = SpackModel('ebrains-spack-builds', install_dir,
'https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/ebrains-spack-builds.git', )
repo = env
......@@ -47,8 +47,8 @@ def test_spack_from_scratch_setup_2():
assert spack_manager.spack_repo_exists(env.env_name) == True
def test_spack_from_scratch_setup_3():
install_dir = Path('./install').resolve()
def test_spack_from_scratch_setup_3(tmp_path):
install_dir = tmp_path
env = SpackModel('new_env1', install_dir)
repo = env
spack_manager = SpackManagerScratch(env=env, repos=[repo, repo], system_name='ebrainslab')
......@@ -56,8 +56,8 @@ def test_spack_from_scratch_setup_3():
spack_manager.setup_spack_env()
def test_spack_from_scratch_setup_4():
install_dir = Path('./install').resolve()
def test_spack_from_scratch_setup_4(tmp_path ):
install_dir = tmp_path
env = SpackModel('new_env2', install_dir)
spack_manager = SpackManagerScratch(env=env)
spack_manager.setup_spack_env()
......
......@@ -4,18 +4,18 @@ from esd.spack_manager.factory.SpackManagerBuildCache import SpackManagerBuildCa
from esd.spack_manager.factory.SpackManagerScratch import SpackManagerScratch
SPACK_VERSION = "0.22.0"
# we need this test to run first so that spack is installed only once
@pytest.mark.run(order=1)
def test_spack_install_scratch():
spack_manager = SpackManagerScratch()
spack_manager.install_spack(spack_version="v0.21.1")
spack_manager.install_spack(spack_version=f'v{SPACK_VERSION}')
installed_spack_version = spack_manager.get_spack_installed_version()
required_version = "0.21.1"
assert required_version == installed_spack_version
assert SPACK_VERSION == installed_spack_version
def test_spack_install_buildcache():
spack_manager = SpackManagerBuildCache()
installed_spack_version = spack_manager.get_spack_installed_version()
required_version = "0.21.1"
assert required_version == installed_spack_version
assert SPACK_VERSION == installed_spack_version
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment