def test_default_output(): "Shell.output should default to sys.stdout" sh = Shell() expect(sh.output).to.equal(sys.stdout)
# 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/>. from __future__ import unicode_literals import sys from datetime import datetime from os.path import relpath from markment.events import after, before from markment.version import version from couleur import Shell sh = Shell(sys.stdout) W = lambda x: relpath(x) @before.exception_handler @after.exception_handler def print_out(event, exception, args, kw): sh.bold_red("\n#ERROR ({0})#\n".format(exception)) @after.file_indexed def file_indexed(event, info, pos, total, siblings): sh.blue("\rIndexing file ") sh.bold_white(str(pos)) sh.blue(" of ")
def make_shell(*args, **kw): context.sh = Shell(context.output, *args, **kw)