Merge pull request #6304 from nicoddemus/pytest-as-pkg

Convert pytest.py into a package
This commit is contained in:
Bruno Oliveira 2019-12-02 21:10:15 -03:00 committed by GitHub
commit 1dc612f7d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -38,8 +38,8 @@ packages =
_pytest.assertion
_pytest.config
_pytest.mark
pytest
py_modules = pytest
python_requires = >=3.5
[options.entry_points]

View File

@ -4,6 +4,7 @@ pytest: unit and functional testing with Python.
"""
from _pytest import __version__
from _pytest.assertion import register_assert_rewrite
from _pytest.compat import _setup_collect_fakemodule
from _pytest.config import cmdline
from _pytest.config import hookimpl
from _pytest.config import hookspec
@ -93,14 +94,6 @@ __all__ = [
"yield_fixture",
]
if __name__ == "__main__":
# if run as a script or by 'python -m pytest'
# we trigger the below "else" condition by the following import
import pytest
raise SystemExit(pytest.main())
else:
from _pytest.compat import _setup_collect_fakemodule
_setup_collect_fakemodule()
_setup_collect_fakemodule()
del _setup_collect_fakemodule

7
src/pytest/__main__.py Normal file
View File

@ -0,0 +1,7 @@
"""
pytest entry point
"""
import pytest
if __name__ == "__main__":
raise SystemExit(pytest.main())