4 new commits in pytest:
https://bitbucket.org/hpk42/pytest/commits/d271a9134e66/
Changeset: d271a9134e66
Branch: color_option
User: Marc Abramowitz
Date: 2013-12-06 20:49:48
Summary: Add option: --color=(yes/no/auto)
Affected #: 2 files
diff -r 1338c1ed28ffbeda49a7a9dbf983de8b569f52db -r
d271a9134e660c05565df8715adefa85d8282a24 _pytest/terminal.py
--- a/_pytest/terminal.py
+++ b/_pytest/terminal.py
@@ -29,6 +29,10 @@
group._addoption('--fulltrace', '--full-trace',
action="store_true", default=False,
help="don't cut any tracebacks (default is to cut).")
+ group._addoption('--color', metavar="color",
+ action="store", dest="color", default='auto',
+ choices=['yes', 'no', 'auto'],
+ help="color output (yes/no/auto).")
def pytest_configure(config):
config.option.verbose -= config.option.quiet
@@ -85,6 +89,10 @@
if file is None:
file = py.std.sys.stdout
self._tw = self.writer = py.io.TerminalWriter(file)
+ if self.config.option.color == 'yes':
+ self._tw.hasmarkup = True
+ if self.config.option.color == 'no':
+ self._tw.hasmarkup = False
self.currentfspath = None
self.reportchars = getreportopt(config)
self.hasmarkup = self._tw.hasmarkup
diff -r 1338c1ed28ffbeda49a7a9dbf983de8b569f52db -r
d271a9134e660c05565df8715adefa85d8282a24 testing/test_terminal.py
--- a/testing/test_terminal.py
+++ b/testing/test_terminal.py
@@ -1,6 +1,7 @@
"""
terminal reporting of the full testing process.
"""
+import os
import pytest, py
import sys
@@ -497,6 +498,18 @@
result = testdir.runpytest('-rf')
assert 'short test summary' not in result.stdout.str()
+def test_color_yes(testdir, monkeypatch):
+ testdir.makepyfile("def test_this(): assert 1")
+ result = testdir.runpytest('--color=yes')
+ assert 'short test summary' not in result.stdout.str()
+ assert u'\x1b[1m' in result.stdout.str()
+
+def test_color_no(testdir):
+ testdir.makepyfile("def test_this(): assert 1")
+ result = testdir.runpytest('--color=no')
+ assert 'short test summary' not in result.stdout.str()
+ assert u'\x1b[1m' not in result.stdout.str()
+
def test_getreportopt():
class config:
class option:
https://bitbucket.org/hpk42/pytest/commits/2cd2f8396739/
Changeset: 2cd2f8396739
Branch: color_option
User: Marc Abramowitz
Date: 2013-12-06 20:58:04
Summary: Assert 'test session starts' in output for test_color_{yes,no}
Affected #: 1 file
diff -r d271a9134e660c05565df8715adefa85d8282a24 -r
2cd2f83967394c3c8b99a305b48510a24a9927c0 testing/test_terminal.py
--- a/testing/test_terminal.py
+++ b/testing/test_terminal.py
@@ -501,13 +501,13 @@
def test_color_yes(testdir, monkeypatch):
testdir.makepyfile("def test_this(): assert 1")
result = testdir.runpytest('--color=yes')
- assert 'short test summary' not in result.stdout.str()
+ assert 'test session starts' in result.stdout.str()
assert u'\x1b[1m' in result.stdout.str()
def test_color_no(testdir):
testdir.makepyfile("def test_this(): assert 1")
result = testdir.runpytest('--color=no')
- assert 'short test summary' not in result.stdout.str()
+ assert 'test session starts' in result.stdout.str()
assert u'\x1b[1m' not in result.stdout.str()
def test_getreportopt():
https://bitbucket.org/hpk42/pytest/commits/f3943e55acb4/
Changeset: f3943e55acb4
Branch: color_option
User: Marc Abramowitz
Date: 2013-12-07 21:04:23
Summary: Remove superfluous `monkeypatch` arg to test_color_yes
Affected #: 1 file
diff -r 2cd2f83967394c3c8b99a305b48510a24a9927c0 -r
f3943e55acb475af23150b573b9af79eace4d859 testing/test_terminal.py
--- a/testing/test_terminal.py
+++ b/testing/test_terminal.py
@@ -498,7 +498,7 @@
result = testdir.runpytest('-rf')
assert 'short test summary' not in result.stdout.str()
-def test_color_yes(testdir, monkeypatch):
+def test_color_yes(testdir):
testdir.makepyfile("def test_this(): assert 1")
result = testdir.runpytest('--color=yes')
assert 'test session starts' in result.stdout.str()
https://bitbucket.org/hpk42/pytest/commits/29c532557679/
Changeset: 29c532557679
User: hpk42
Date: 2013-12-08 20:19:37
Summary: Merged in msabramo/pytest/color_option (pull request #90)
Add option: --color=(yes/no/auto)
Affected #: 2 files
diff -r fb2e642e27d18b1aadfda9500742711f0feb6001 -r
29c532557679f99a52a8702ad7543c79747b2c0c _pytest/terminal.py
--- a/_pytest/terminal.py
+++ b/_pytest/terminal.py
@@ -29,6 +29,10 @@
group._addoption('--fulltrace', '--full-trace',
action="store_true", default=False,
help="don't cut any tracebacks (default is to cut).")
+ group._addoption('--color', metavar="color",
+ action="store", dest="color", default='auto',
+ choices=['yes', 'no', 'auto'],
+ help="color output (yes/no/auto).")
def pytest_configure(config):
config.option.verbose -= config.option.quiet
@@ -85,6 +89,10 @@
if file is None:
file = py.std.sys.stdout
self._tw = self.writer = py.io.TerminalWriter(file)
+ if self.config.option.color == 'yes':
+ self._tw.hasmarkup = True
+ if self.config.option.color == 'no':
+ self._tw.hasmarkup = False
self.currentfspath = None
self.reportchars = getreportopt(config)
self.hasmarkup = self._tw.hasmarkup
diff -r fb2e642e27d18b1aadfda9500742711f0feb6001 -r
29c532557679f99a52a8702ad7543c79747b2c0c testing/test_terminal.py
--- a/testing/test_terminal.py
+++ b/testing/test_terminal.py
@@ -1,6 +1,7 @@
"""
terminal reporting of the full testing process.
"""
+import os
import pytest, py
import sys
@@ -497,6 +498,18 @@
result = testdir.runpytest('-rf')
assert 'short test summary' not in result.stdout.str()
+def test_color_yes(testdir):
+ testdir.makepyfile("def test_this(): assert 1")
+ result = testdir.runpytest('--color=yes')
+ assert 'test session starts' in result.stdout.str()
+ assert u'\x1b[1m' in result.stdout.str()
+
+def test_color_no(testdir):
+ testdir.makepyfile("def test_this(): assert 1")
+ result = testdir.runpytest('--color=no')
+ assert 'test session starts' in result.stdout.str()
+ assert u'\x1b[1m' not in result.stdout.str()
+
def test_getreportopt():
class config:
class option:
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-commit