Skip to content

Commit

Permalink
add a test for the 'autoinstalled' file not existing
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverkurth committed May 10, 2022
1 parent 86576d7 commit 9aabfaf
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pytests/tests/test_autoremove.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,33 @@ def test_autoremove_conf_false_autoremove(utils):
assert(not utils.check_package(pkgname))
# actual test:
assert(not utils.check_package(pkgname_req))


# check issues with the 'autoinstalled' file not existing
# or the directory (PR #316)
def test_no_autoinstalled_dir(utils):
pkgname = utils.config["mulversion_pkgname"]
utils.install_package(pkgname)
os.rename('/var/lib/tdnf', '/var/lib/tdnf.away')
ret = utils.run(['tdnf', '-y', 'install', pkgname])
assert(ret['retval'] == 0)
assert(utils.check_package(pkgname))


def test_no_autoinstalled_file(utils):
pkgname = utils.config["mulversion_pkgname"]
utils.install_package(pkgname)
os.rename('/var/lib/tdnf/autoinstalled', '/var/lib/tdnf/autoinstalled.away')
ret = utils.run(['tdnf', '-y', 'install', pkgname])
assert(ret['retval'] == 0)
assert(utils.check_package(pkgname))


def test_no_autoinstalled_empty(utils):
pkgname = utils.config["mulversion_pkgname"]
utils.install_package(pkgname)
os.rename('/var/lib/tdnf/autoinstalled', '/var/lib/tdnf/autoinstalled.away')
os.mknod('/var/lib/tdnf/autoinstalled')
ret = utils.run(['tdnf', '-y', 'install', pkgname])
assert(ret['retval'] == 0)
assert(utils.check_package(pkgname))

0 comments on commit 9aabfaf

Please sign in to comment.