summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2023-02-12 17:07:34 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2023-02-12 20:07:53 +0100
commite809036dec464c49679768ab468066d544d06ad0 (patch)
tree32ddf2ba89b6ee7975e85c222f47eba5879d9992 /tests
parent55afe5de59b8aa3ee5fcbd98607ad90af17ca819 (diff)
downloadastroid-git-e809036dec464c49679768ab468066d544d06ad0.tar.gz
[brain tests] Burst pytest from the main file
Diffstat (limited to 'tests')
-rw-r--r--tests/brain/test_brain.py28
-rw-r--r--tests/brain/test_exceptions.py0
-rw-r--r--tests/brain/test_pytest.py34
3 files changed, 34 insertions, 28 deletions
diff --git a/tests/brain/test_brain.py b/tests/brain/test_brain.py
index 700d5b4e..316e742f 100644
--- a/tests/brain/test_brain.py
+++ b/tests/brain/test_brain.py
@@ -143,34 +143,6 @@ class ThreadingBrainTest(unittest.TestCase):
self.assertIsInstance(next(inferred.igetattr(method)), astroid.BoundMethod)
-class PytestBrainTest(unittest.TestCase):
- def test_pytest(self) -> None:
- ast_node = builder.extract_node(
- """
- import pytest
- pytest #@
- """
- )
- module = next(ast_node.infer())
- attrs = [
- "deprecated_call",
- "warns",
- "exit",
- "fail",
- "skip",
- "importorskip",
- "xfail",
- "mark",
- "raises",
- "freeze_includes",
- "set_trace",
- "fixture",
- "yield_fixture",
- ]
- for attr in attrs:
- self.assertIn(attr, module)
-
-
def streams_are_fine():
"""Check if streams are being overwritten,
for example, by pytest
diff --git a/tests/brain/test_exceptions.py b/tests/brain/test_exceptions.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/brain/test_exceptions.py
diff --git a/tests/brain/test_pytest.py b/tests/brain/test_pytest.py
new file mode 100644
index 00000000..55ecfb2d
--- /dev/null
+++ b/tests/brain/test_pytest.py
@@ -0,0 +1,34 @@
+# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
+# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
+# Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt
+
+from __future__ import annotations
+
+from astroid import builder
+
+
+def test_pytest() -> None:
+ ast_node = builder.extract_node(
+ """
+ import pytest
+ pytest #@
+ """
+ )
+ module = next(ast_node.infer())
+ attrs = [
+ "deprecated_call",
+ "warns",
+ "exit",
+ "fail",
+ "skip",
+ "importorskip",
+ "xfail",
+ "mark",
+ "raises",
+ "freeze_includes",
+ "set_trace",
+ "fixture",
+ "yield_fixture",
+ ]
+ for attr in attrs:
+ assert attr in module