summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-03-10 11:33:12 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2020-03-10 11:33:12 +0100
commitbaa58746a2c9e51b757c623c883a02151bda4265 (patch)
treee7b8aa203dfc9fda28fee3e544760d7afc7ded7f
parentff0a72484b2560682aced148b04aebb12d6d369d (diff)
downloadastroid-git-baa58746a2c9e51b757c623c883a02151bda4265.tar.gz
Use pytest.xfail instead of unittest.expectedFailure to have a common decorator across the codebase
-rw-r--r--tests/unittest_inference.py10
-rw-r--r--tests/unittest_object_model.py4
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py
index 6c6331d9..f91960d7 100644
--- a/tests/unittest_inference.py
+++ b/tests/unittest_inference.py
@@ -511,7 +511,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
self.assertEqual(inferred.name, "unicode")
self.assertIn("lower", inferred._proxied.locals)
- @unittest.expectedFailure
+ @pytest.mark.xfail(reason="Descriptors are not properly inferred as callable")
def test_descriptor_are_callable(self):
code = """
class A:
@@ -3259,7 +3259,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
self.assertIsInstance(inferred, Instance)
self.assertEqual(inferred.name, "B")
- @unittest.expectedFailure
+ @pytest.mark.xfail(reason="String interpolation is incorrect for modulo formatting")
def test_string_interpolation(self):
ast_nodes = extract_node(
"""
@@ -3631,7 +3631,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
]
self.assertEqual(titles, ["Catch 22", "Ubik", "Grimus"])
- @unittest.expectedFailure
+ @pytest.mark.xfail(reason="Does not support function metaclasses")
def test_function_metaclasses(self):
# These are not supported right now, although
# they will be in the future.
@@ -3778,7 +3778,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
second = next(ast_nodes[1].infer())
self.assertIsInstance(second, Instance)
- @unittest.expectedFailure
+ @pytest.mark.xfail(reason="Metaclass arguments not inferred as classes")
def test_metaclass_arguments_are_classes_not_instances(self):
ast_node = extract_node(
"""
@@ -3908,7 +3908,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
self.assertIsInstance(inferred, nodes.Const)
self.assertEqual(inferred.value, 25)
- @unittest.expectedFailure
+ @pytest.mark.xfail(reason="Cannot reuse inner value due to inference context reuse")
def test_inner_value_redefined_by_subclass_with_mro(self):
# This might work, but it currently doesn't due to not being able
# to reuse inference contexts.
diff --git a/tests/unittest_object_model.py b/tests/unittest_object_model.py
index ac42485a..d201ec9b 100644
--- a/tests/unittest_object_model.py
+++ b/tests/unittest_object_model.py
@@ -58,7 +58,7 @@ class InstanceModelTest(unittest.TestCase):
self.assertIsInstance(attr, astroid.Const)
self.assertEqual(attr.value, 42)
- @unittest.expectedFailure
+ @pytest.mark.xfail(reason="Instance lookup cannot override object model")
def test_instance_local_attributes_overrides_object_model(self):
# The instance lookup needs to be changed in order for this to work.
ast_node = builder.extract_node(
@@ -354,7 +354,7 @@ class FunctionModelTest(unittest.TestCase):
inferred = next(node.infer())
assert inferred is util.Uninferable
- @unittest.expectedFailure
+ @pytest.mark.xfail(reason="Descriptors cannot infer what self is")
def test_descriptor_not_inferrring_self(self):
# We can't infer __get__(X, Y)() when the bounded function
# uses self, because of the tree's parent not being propagating good enough.