summaryrefslogtreecommitdiff
blob: dd5b892606a372276311a75174321289e22dabc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
commit a35c394f7f4eb714eeaab1b8ed7977f822e29fa9
Author: mulhern <amulhern@redhat.com>
Date:   Wed May 2 15:50:45 2018 -0400

    Get rid of all test_match_attribute_* methods
    
    These tests are rendered flaky by the volatility of attribute values.
    
    Signed-off-by: mulhern <amulhern@redhat.com>

diff --git a/tests/test_enumerate.py b/tests/test_enumerate.py
index f054799..c9c6a67 100644
--- a/tests/test_enumerate.py
+++ b/tests/test_enumerate.py
@@ -200,77 +200,6 @@ def test_match_property_bool(self, context, pair):
            for device in devices
         )
 
-    @failed_health_check_wrapper
-    @given(_CONTEXT_STRATEGY, _ATTRIBUTE_STRATEGY)
-    @settings(max_examples=50)
-    def test_match_attribute_nomatch_unfulfillable(self, context, pair):
-        """
-        Match and no match for a key/value gives empty set.
-        """
-        key, value = pair
-        devices = context.list_devices()
-        devices.match_attribute(key, value)
-        devices.match_attribute(key, value, nomatch=True)
-        assert not list(devices)
-
-    @failed_health_check_wrapper
-    @given(_CONTEXT_STRATEGY, _ATTRIBUTE_STRATEGY)
-    @settings(max_examples=50)
-    def test_match_attribute_nomatch_complete(self, context, pair):
-        """
-        Test that w/ respect to the universe of devices returned by
-        list_devices() a match and its inverse are complements of each other.
-        """
-        key, value = pair
-        m_devices = frozenset(context.list_devices().match_attribute(
-            key, value))
-        nm_devices = frozenset(context.list_devices().match_attribute(
-            key, value, nomatch=True))
-        _test_intersection_and_union(context, m_devices, nm_devices)
-
-    @failed_health_check_wrapper
-    @given(_CONTEXT_STRATEGY, _ATTRIBUTE_STRATEGY)
-    @settings(max_examples=50)
-    def test_match_attribute_string(self, context, pair):
-        """
-        Test that matching attribute as string works.
-        """
-        key, value = pair
-        devices = context.list_devices().match_attribute(key, value)
-        assert all(device.attributes.get(key) == value for device in devices)
-
-    @failed_health_check_wrapper
-    @given(_CONTEXT_STRATEGY,
-           _ATTRIBUTE_STRATEGY.filter(lambda x: _is_int(x[1])))
-    @settings(max_examples=50)
-    def test_match_attribute_int(self, context, pair):
-        """
-        Test matching integer attribute.
-        """
-        key, value = pair
-        int_value = int(value)
-        devices = context.list_devices().match_attribute(key, int_value)
-        for device in devices:
-            attributes = device.attributes
-            assert attributes.get(key) == value
-            assert device.attributes.asint(key) == int_value
-
-    @failed_health_check_wrapper
-    @given(_CONTEXT_STRATEGY,
-           _ATTRIBUTE_STRATEGY.filter(lambda x: _is_bool(x[1])))
-    @settings(max_examples=50)
-    def test_match_attribute_bool(self, context, pair):
-        """
-        Test matching boolean attribute.
-        """
-        key, value = pair
-        bool_value = True if int(value) == 1 else False
-        devices = context.list_devices().match_attribute(key, bool_value)
-        for device in devices:
-            attributes = device.attributes
-            assert attributes.get(key) == value
-            assert attributes.asbool(key) == bool_value
-
     @_UDEV_TEST(154, "test_match_tag")
     @failed_health_check_wrapper
     @given(_CONTEXT_STRATEGY, _TAG_STRATEGY)
@@ -335,33 +264,6 @@ def test_combined_property_matches(self, context, ppairs):
            )
         )
 
-    @given(_CONTEXT_STRATEGY,
-           strategies.lists(
-               elements=_ATTRIBUTE_STRATEGY,
-               min_size=2,
-               max_size=3,
-               unique_by=lambda p: p[0]))
-    @settings(max_examples=20)
-    def test_combined_attribute_matches(self, context, apairs):
-        """
-        Test for conjunction of attributes.
-
-        If matching multiple attributes, then the result is the intersection of
-        the matching sets, i.e., the resulting filter is a conjunction.
-        """
-        enumeration = context.list_devices()
-
-        for key, value in apairs:
-            enumeration.match_attribute(key, value)
-
-        _test_direct_and_complement(
-           context,
-           frozenset(enumeration),
-           lambda d: all(
-              d.attributes.get(key) == value for key, value in apairs
-           )
-        )
-
     @given(_CONTEXT_STRATEGY,
            strategies.lists(
                elements=_MATCH_PROPERTY_STRATEGY,