pytest.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # -*- coding: utf-8 -*-
  2. # PYTHON_ARGCOMPLETE_OK
  3. """
  4. pytest: unit and functional testing with Python.
  5. """
  6. # else we are imported
  7. from _pytest import __version__
  8. from _pytest.assertion import register_assert_rewrite
  9. from _pytest.config import cmdline
  10. from _pytest.config import hookimpl
  11. from _pytest.config import hookspec
  12. from _pytest.config import main
  13. from _pytest.config import UsageError
  14. from _pytest.debugging import pytestPDB as __pytestPDB
  15. from _pytest.fixtures import fillfixtures as _fillfuncargs
  16. from _pytest.fixtures import fixture
  17. from _pytest.fixtures import yield_fixture
  18. from _pytest.freeze_support import freeze_includes
  19. from _pytest.main import Session
  20. from _pytest.mark import MARK_GEN as mark
  21. from _pytest.mark import param
  22. from _pytest.nodes import Collector
  23. from _pytest.nodes import File
  24. from _pytest.nodes import Item
  25. from _pytest.outcomes import exit
  26. from _pytest.outcomes import fail
  27. from _pytest.outcomes import importorskip
  28. from _pytest.outcomes import skip
  29. from _pytest.outcomes import xfail
  30. from _pytest.python import Class
  31. from _pytest.python import Function
  32. from _pytest.python import Instance
  33. from _pytest.python import Module
  34. from _pytest.python import Package
  35. from _pytest.python_api import approx
  36. from _pytest.python_api import raises
  37. from _pytest.recwarn import deprecated_call
  38. from _pytest.recwarn import warns
  39. from _pytest.warning_types import PytestAssertRewriteWarning
  40. from _pytest.warning_types import PytestCacheWarning
  41. from _pytest.warning_types import PytestCollectionWarning
  42. from _pytest.warning_types import PytestConfigWarning
  43. from _pytest.warning_types import PytestDeprecationWarning
  44. from _pytest.warning_types import PytestExperimentalApiWarning
  45. from _pytest.warning_types import PytestUnhandledCoroutineWarning
  46. from _pytest.warning_types import PytestUnknownMarkWarning
  47. from _pytest.warning_types import PytestWarning
  48. from _pytest.warning_types import RemovedInPytest4Warning
  49. set_trace = __pytestPDB.set_trace
  50. __all__ = [
  51. "__version__",
  52. "_fillfuncargs",
  53. "approx",
  54. "Class",
  55. "cmdline",
  56. "Collector",
  57. "deprecated_call",
  58. "exit",
  59. "fail",
  60. "File",
  61. "fixture",
  62. "freeze_includes",
  63. "Function",
  64. "hookimpl",
  65. "hookspec",
  66. "importorskip",
  67. "Instance",
  68. "Item",
  69. "main",
  70. "mark",
  71. "Module",
  72. "Package",
  73. "param",
  74. "PytestAssertRewriteWarning",
  75. "PytestCacheWarning",
  76. "PytestCollectionWarning",
  77. "PytestConfigWarning",
  78. "PytestDeprecationWarning",
  79. "PytestExperimentalApiWarning",
  80. "PytestUnhandledCoroutineWarning",
  81. "PytestUnknownMarkWarning",
  82. "PytestWarning",
  83. "raises",
  84. "register_assert_rewrite",
  85. "RemovedInPytest4Warning",
  86. "Session",
  87. "set_trace",
  88. "skip",
  89. "UsageError",
  90. "warns",
  91. "xfail",
  92. "yield_fixture",
  93. ]
  94. if __name__ == "__main__":
  95. # if run as a script or by 'python -m pytest'
  96. # we trigger the below "else" condition by the following import
  97. import pytest
  98. raise SystemExit(pytest.main())
  99. else:
  100. from _pytest.compat import _setup_collect_fakemodule
  101. _setup_collect_fakemodule()