Skip to content

Commit

Permalink
Change fixtures to have a better teardown
Browse files Browse the repository at this point in the history
We change the fistures used to have a better teardown.
We don't want the repo file to stay on the server when a test failed.

Signed-off-by: Gael Duperrey <[email protected]>
  • Loading branch information
gduperrey committed Aug 24, 2023
1 parent 9fa2d62 commit fd3c22d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/storage/fsp/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

DIRECTORIES_PATH = 'directories'

def install_fsp(host):
@pytest.fixture(scope='package')
def host_with_runx_repo(host_with_saved_yum_state):
host = host_with_saved_yum_state
host.add_xcpng_repo(FSP_REPO_NAME, 'vates')
host.yum_save_state()
host.yum_install(FSP_PACKAGES)

def uninstall_fsp(host):
host.yum_restore_saved_state()
yield host
# teardown
host.remove_xcpng_repo(FSP_REPO_NAME)

@pytest.fixture(scope='package')
def host_with_fsp(host):
install_fsp(host)
def host_with_fsp(host_with_runx_repo):
host = host_with_runx_repo
host.yum_install(FSP_PACKAGES)
yield host
uninstall_fsp(host)
# teardown: nothing to do, done by host_with_saved_yum_state.

@pytest.fixture(scope='package')
def fsp_config(host_with_fsp):
Expand Down

0 comments on commit fd3c22d

Please sign in to comment.