def run(*argv): key = str(b"PYTHONPATH") python_paths = (i for i in (str(os.getcwd()), os.getenv(key)) if i) monkeypatch.setenv(key, os.pathsep.join(python_paths)) with RunResult(capfd, argv) as result: try: main([str(x) for x in argv]) assert False # this should always exist with SystemExit except SystemExit as exception: result.ret = exception.code except OSError as e: result.ret = e.errno return result
def run(*argv): key = str("PYTHONPATH") python_paths = (i for i in (os.getcwd(), os.getenv(key)) if i) monkeypatch.setenv(key, os.pathsep.join(python_paths)) with RunResult(capfd, argv) as result: prev_run_command = Session.runcommand def run_command(self): result.session = self return prev_run_command(self) monkeypatch.setattr(Session, "runcommand", run_command) try: main([str(x) for x in argv]) assert False # this should always exist with SystemExit except SystemExit as exception: result.ret = exception.code except OSError as e: result.ret = e.errno return result
from tox.session import main if __name__ == "__main__": main()
def run_tests(self): from tox.session import main errno = main(sys.argv[2:]) sys.exit(errno)
import sys from tox.session import main if __name__ == '__main__': main(sys.argv[1:])