Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set installroot in Python unit tests #775

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions test/python3/libdnf5/base/test_goal.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

import libdnf5.base

import base_test_case

class TestGoal(unittest.TestCase):

class TestGoal(base_test_case.BaseTestCase):
def test_missing_setup_goal_resolve(self):
# Create a new Base object
base = libdnf5.base.Base()
Expand All @@ -33,39 +35,31 @@ def test_missing_setup_goal_resolve(self):

def test_missing_rpm_goal_resolve(self):
# Try to resolve the goal using unknown RPM package
base = libdnf5.base.Base()
base.setup()

goal = libdnf5.base.Goal(base)
goal = libdnf5.base.Goal(self.base)
goal.add_install('unknown_pkg.rpm')

self.assertRaises(RuntimeError, goal.resolve)

def test_invalid_url_goal_resolve(self):
# Try to resolve the goal using invalid URL
base = libdnf5.base.Base()
base.setup()

goal = libdnf5.base.Goal(base)
goal = libdnf5.base.Goal(self.base)
goal.add_install('https://i-dont-exist.com')

self.assertRaises(RuntimeError, goal.resolve)

def test_unsupported_argument_add_remove(self):
# Try passing unsupported argument to add_remove() method
base = libdnf5.base.Base()
base.setup()

goal = libdnf5.base.Goal(base)
goal = libdnf5.base.Goal(self.base)

self.assertRaises(RuntimeError, goal.add_remove, 'pkg.rpm')

def test_group_rpm_reason_change_without_id(self):
# Try changing group reason without group_id
base = libdnf5.base.Base()
base.setup()

goal = libdnf5.base.Goal(base)
goal = libdnf5.base.Goal(self.base)

self.assertRaises(RuntimeError, goal.add_rpm_reason_change, '@fake-group-spec',
libdnf5.base.transaction.TransactionItemReason_GROUP, '')
Expand All @@ -74,10 +68,7 @@ def test_log_events_wrapper(self):
# Try accessing transaction.get_resolve_logs()
spec = 'unknown_spec'

base = libdnf5.base.Base()
base.setup()

goal = libdnf5.base.Goal(base)
goal = libdnf5.base.Goal(self.base)
goal.add_install(spec)

transaction = goal.resolve()
Expand Down
Loading