def test_main_wrapper_informative_return_code(capsys, monkeypatch, tmpdir): test_dir = tmpdir.join('test').strpath copytree('tests/data/test_not_running', test_dir) monkeypatch.setattr( 'sys.argv', ['rdial', '--directory', test_dir, 'run', '-c', '( exit 50 )', 'task']) result = main() assert result == 50 assert 'Task task running for' in capsys.readouterr()[0]
def test_main_wrapper_informative_return_code(capsys, monkeypatch, tmpdir): test_dir = tmpdir.join('test').strpath copytree('tests/data/test_not_running', test_dir) monkeypatch.setattr( 'sys.argv', ['rdial', '--directory', test_dir, 'run', '-c', '( exit 50 )', 'task'] ) result = main() assert result == 50 assert 'Task task running for' in capsys.readouterr()[0]
def test_main_wrapper(monkeypatch, capsys): monkeypatch.setattr('sys.argv', ['rdial', '--directory', 'tests/data/test', 'running']) def exit_mock(n): if n == 0: return n else: raise ValueError(n) monkeypatch.setattr('sys.exit', exit_mock) result = main() assert result == 0 assert 'Task “task” started' in capsys.readouterr()[0]
def test_main_wrapper(monkeypatch, capsys): monkeypatch.setattr( 'sys.argv', ['rdial', '--directory', 'tests/data/test', 'running'] ) def exit_mock(n): if n == 0: return n else: raise ValueError(n) monkeypatch.setattr('sys.exit', exit_mock) result = main() assert result == 0 assert 'Task “task” started' in capsys.readouterr()[0]
def test_main_wrapper_error(monkeypatch, capsys): monkeypatch.setattr( 'sys.argv', ['rdial', '--directory', 'tests/data/test_not_running', 'stop']) def exit_mock(n): if n == 0: return n else: raise ValueError(n) monkeypatch.setattr('sys.exit', exit_mock) result = main() assert result == 2 assert capsys.readouterr()[1] == 'No task running!\n'
def test_main_wrapper_error(monkeypatch, capsys): monkeypatch.setattr( 'sys.argv', ['rdial', '--directory', 'tests/data/test_not_running', 'stop'] ) def exit_mock(n): if n == 0: return n else: raise ValueError(n) monkeypatch.setattr('sys.exit', exit_mock) result = main() assert result == 2 assert capsys.readouterr()[1] == 'No task running!\n'
#! /usr/bin/env python3 """rdial - Minimal time tracking for maximal benefit.""" # Copyright © 2011-2019 James Rowe <*****@*****.**> # # SPDX-License-Identifier: GPL-3.0+ # # This file is part of rdial. # # rdial is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any later # version. # # rdial is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # rdial. If not, see <http://www.gnu.org/licenses/>. import sys from rdial import cmdline sys.exit(cmdline.main())
#! /usr/bin/python -tt # coding=utf-8 """rdial - Simple time tracking for simple people""" # Copyright © 2011, 2012, 2013 James Rowe <*****@*****.**> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import sys from rdial import cmdline sys.exit(cmdline.main())