2010-10-07 17:59:00 +08:00
|
|
|
"""
|
|
|
|
extensible functional and unit testing with Python.
|
|
|
|
(c) Holger Krekel and others, 2004-2010
|
|
|
|
"""
|
2010-10-10 19:48:48 +08:00
|
|
|
__version__ = "2.0.0dev0"
|
2010-10-10 19:48:49 +08:00
|
|
|
import pytest._config
|
2010-10-07 17:59:00 +08:00
|
|
|
from pytest import collect
|
|
|
|
|
2010-10-10 19:48:49 +08:00
|
|
|
__all__ = ['collect', 'cmdline']
|
|
|
|
|
2010-10-10 19:48:48 +08:00
|
|
|
class cmdline: # compatibility py.test.cmdline.main == pytest.cmdline.main
|
|
|
|
@staticmethod
|
|
|
|
def main(args=None):
|
|
|
|
import sys
|
|
|
|
if args is None:
|
|
|
|
args = sys.argv[1:]
|
2010-10-10 19:48:49 +08:00
|
|
|
config = pytest._config.config_per_process = pytest._config.Config()
|
2010-10-10 19:48:48 +08:00
|
|
|
config.parse(args)
|
|
|
|
try:
|
|
|
|
exitstatus = config.hook.pytest_cmdline_main(config=config)
|
|
|
|
except config.Error:
|
|
|
|
e = sys.exc_info()[1]
|
|
|
|
sys.stderr.write("ERROR: %s\n" %(e.args[0],))
|
|
|
|
exitstatus = EXIT_INTERNALERROR
|
|
|
|
return exitstatus
|
|
|
|
|
2010-10-07 17:59:00 +08:00
|
|
|
def __main__():
|
2010-10-10 19:48:48 +08:00
|
|
|
raise SystemExit(cmdline.main())
|