def test_main_version(capsys, mocker, argv): mocker.patch("sys.argv", [os.path.basename(main.__code__.co_filename), *argv]) with pytest.raises(SystemExit) as ex: main() assert ex.value == 0 captured = capsys.readouterr() assert "pudb:run.py v" in captured.out
def pugdb_entry(): from pudb.run import main if (os.getenv('TMUX') is None): sys.stderr.write('Error: "pugdb" must be executed inside "tmux".\n') sys.exit(1) os.system('tmux new-window -ad -n *PuGDB* gdb -ex c --pid %s' % os.getpid()) sys.exit(main())
def test_main_v_with_args(capsys, mocker): """ This will fail, because args is not only ``-v``, and that's reserved for future use ... """ mocker.patch("sys.argv", [ os.path.basename(main.__code__.co_filename), "-v", "dont_look_at_me.py" ]) with pytest.raises(SystemExit) as ex: main() assert ex.value == 2 captured = capsys.readouterr() assert "error: unrecognized arguments: -v" in captured.err assert not captured.out
if __name__ == "__main__": from pudb.run import main main()
__copyright__ = """ Copyright (C) 2009-2017 Andreas Kloeckner Copyright (C) 2014-2017 Aaron Meurer """ __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ if __name__ == "__main__": from pudb.run import main main()
def pudb_entry(): from pudb.run import main sys.exit(main())