Skip to content

Commit

Permalink
Hawkey tests: fix filtering on requires by passing a query
Browse files Browse the repository at this point in the history
Fixes tests after allowing to pass a query (or an iterable of packages)
as an argument to dependency filters (requires, suggests, etc.) in
"Query: add a dependency by solvable filter".

Drops the exception check and adds a simple test for the new
functionality.
  • Loading branch information
Lukáš Hrázký committed Nov 5, 2019
1 parent 0e78959 commit 13911cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/hawkey/tests/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,17 @@ def test_obsoletes(self):
q = hawkey.Query(self.sack).filter(name="penny")
o = hawkey.Query(self.sack)
self.assertRaises(hawkey.QueryException, o.filter, obsoletes__gt=q)
self.assertRaises(hawkey.ValueException, o.filter, requires=q)

o = hawkey.Query(self.sack).filter(obsoletes=q)
self.assertLength(o, 1)
self.assertEqual(str(o[0]), "fool-1-5.noarch")

def test_requires_with_package_list(self):
q = hawkey.Query(self.sack).filter(name="fool")
o = hawkey.Query(self.sack).filter(requires=q)
self.assertLength(o, 1)
self.assertEqual(str(o[0]), "walrus-2-6.noarch")

def test_subquery_evaluated(self):
q = hawkey.Query(self.sack).filter(name="penny")
self.assertFalse(q.evaluated)
Expand Down

0 comments on commit 13911cb

Please sign in to comment.