__init__.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. # PYTHON_ARGCOMPLETE_OK
  2. """pytest: unit and functional testing with Python."""
  3. from . import collect
  4. from _pytest import __version__
  5. from _pytest import version_tuple
  6. from _pytest._code import ExceptionInfo
  7. from _pytest.assertion import register_assert_rewrite
  8. from _pytest.cacheprovider import Cache
  9. from _pytest.capture import CaptureFixture
  10. from _pytest.config import cmdline
  11. from _pytest.config import Config
  12. from _pytest.config import console_main
  13. from _pytest.config import ExitCode
  14. from _pytest.config import hookimpl
  15. from _pytest.config import hookspec
  16. from _pytest.config import main
  17. from _pytest.config import PytestPluginManager
  18. from _pytest.config import UsageError
  19. from _pytest.config.argparsing import OptionGroup
  20. from _pytest.config.argparsing import Parser
  21. from _pytest.debugging import pytestPDB as __pytestPDB
  22. from _pytest.fixtures import _fillfuncargs
  23. from _pytest.fixtures import fixture
  24. from _pytest.fixtures import FixtureLookupError
  25. from _pytest.fixtures import FixtureRequest
  26. from _pytest.fixtures import yield_fixture
  27. from _pytest.freeze_support import freeze_includes
  28. from _pytest.legacypath import TempdirFactory
  29. from _pytest.legacypath import Testdir
  30. from _pytest.logging import LogCaptureFixture
  31. from _pytest.main import Session
  32. from _pytest.mark import Mark
  33. from _pytest.mark import MARK_GEN as mark
  34. from _pytest.mark import MarkDecorator
  35. from _pytest.mark import MarkGenerator
  36. from _pytest.mark import param
  37. from _pytest.monkeypatch import MonkeyPatch
  38. from _pytest.nodes import Collector
  39. from _pytest.nodes import File
  40. from _pytest.nodes import Item
  41. from _pytest.outcomes import exit
  42. from _pytest.outcomes import fail
  43. from _pytest.outcomes import importorskip
  44. from _pytest.outcomes import skip
  45. from _pytest.outcomes import xfail
  46. from _pytest.pytester import HookRecorder
  47. from _pytest.pytester import LineMatcher
  48. from _pytest.pytester import Pytester
  49. from _pytest.pytester import RecordedHookCall
  50. from _pytest.pytester import RunResult
  51. from _pytest.python import Class
  52. from _pytest.python import Function
  53. from _pytest.python import Metafunc
  54. from _pytest.python import Module
  55. from _pytest.python import Package
  56. from _pytest.python_api import approx
  57. from _pytest.python_api import raises
  58. from _pytest.recwarn import deprecated_call
  59. from _pytest.recwarn import WarningsRecorder
  60. from _pytest.recwarn import warns
  61. from _pytest.reports import CollectReport
  62. from _pytest.reports import TestReport
  63. from _pytest.runner import CallInfo
  64. from _pytest.stash import Stash
  65. from _pytest.stash import StashKey
  66. from _pytest.tmpdir import TempPathFactory
  67. from _pytest.warning_types import PytestAssertRewriteWarning
  68. from _pytest.warning_types import PytestCacheWarning
  69. from _pytest.warning_types import PytestCollectionWarning
  70. from _pytest.warning_types import PytestConfigWarning
  71. from _pytest.warning_types import PytestDeprecationWarning
  72. from _pytest.warning_types import PytestExperimentalApiWarning
  73. from _pytest.warning_types import PytestRemovedIn7Warning
  74. from _pytest.warning_types import PytestRemovedIn8Warning
  75. from _pytest.warning_types import PytestUnhandledCoroutineWarning
  76. from _pytest.warning_types import PytestUnhandledThreadExceptionWarning
  77. from _pytest.warning_types import PytestUnknownMarkWarning
  78. from _pytest.warning_types import PytestUnraisableExceptionWarning
  79. from _pytest.warning_types import PytestWarning
  80. set_trace = __pytestPDB.set_trace
  81. __all__ = [
  82. "__version__",
  83. "_fillfuncargs",
  84. "approx",
  85. "Cache",
  86. "CallInfo",
  87. "CaptureFixture",
  88. "Class",
  89. "cmdline",
  90. "collect",
  91. "Collector",
  92. "CollectReport",
  93. "Config",
  94. "console_main",
  95. "deprecated_call",
  96. "exit",
  97. "ExceptionInfo",
  98. "ExitCode",
  99. "fail",
  100. "File",
  101. "fixture",
  102. "FixtureLookupError",
  103. "FixtureRequest",
  104. "freeze_includes",
  105. "Function",
  106. "hookimpl",
  107. "HookRecorder",
  108. "hookspec",
  109. "importorskip",
  110. "Item",
  111. "LineMatcher",
  112. "LogCaptureFixture",
  113. "main",
  114. "mark",
  115. "Mark",
  116. "MarkDecorator",
  117. "MarkGenerator",
  118. "Metafunc",
  119. "Module",
  120. "MonkeyPatch",
  121. "OptionGroup",
  122. "Package",
  123. "param",
  124. "Parser",
  125. "PytestAssertRewriteWarning",
  126. "PytestCacheWarning",
  127. "PytestCollectionWarning",
  128. "PytestConfigWarning",
  129. "PytestDeprecationWarning",
  130. "PytestExperimentalApiWarning",
  131. "PytestRemovedIn7Warning",
  132. "PytestRemovedIn8Warning",
  133. "Pytester",
  134. "PytestPluginManager",
  135. "PytestUnhandledCoroutineWarning",
  136. "PytestUnhandledThreadExceptionWarning",
  137. "PytestUnknownMarkWarning",
  138. "PytestUnraisableExceptionWarning",
  139. "PytestWarning",
  140. "raises",
  141. "RecordedHookCall",
  142. "register_assert_rewrite",
  143. "RunResult",
  144. "Session",
  145. "set_trace",
  146. "skip",
  147. "Stash",
  148. "StashKey",
  149. "version_tuple",
  150. "TempdirFactory",
  151. "TempPathFactory",
  152. "Testdir",
  153. "TestReport",
  154. "UsageError",
  155. "WarningsRecorder",
  156. "warns",
  157. "xfail",
  158. "yield_fixture",
  159. ]
  160. def __getattr__(name: str) -> object:
  161. if name == "Instance":
  162. # The import emits a deprecation warning.
  163. from _pytest.python import Instance
  164. return Instance
  165. raise AttributeError(f"module {__name__} has no attribute {name}")