diff options
| author | Jelmer Vernooij <jelmer@samba.org> | 2010-01-16 17:33:40 +1300 |
|---|---|---|
| committer | Jelmer Vernooij <jelmer@samba.org> | 2010-01-16 17:33:40 +1300 |
| commit | cbbebec02cdadaca43dff5daae6e7ae3ea457d6e (patch) | |
| tree | 3dcd3725575508ff02812a54ec279d0db30219b2 /python/subunit/__init__.py | |
| parent | 1fcae436eddfb4bf36fd99ddde1558b526f3ccdb (diff) | |
| parent | 40935f3e52ab8a7695c871e1f8176aea70eef902 (diff) | |
| download | subunit-git-cbbebec02cdadaca43dff5daae6e7ae3ea457d6e.tar.gz | |
Merge SUBUNIT_FORMATTER patch.
Diffstat (limited to 'python/subunit/__init__.py')
| -rw-r--r-- | python/subunit/__init__.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index 73dbc17..6b65ae4 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -1111,3 +1111,16 @@ class TestResultStats(unittest.TestResult): def wasSuccessful(self): """Tells whether or not this result was a success""" return self.failed_tests == 0 + + +def get_default_formatter(): + """Obtain the default formatter to write to. + + :return: A file-like object. + """ + formatter = os.getenv("SUBUNIT_FORMATTER") + if formatter: + return os.popen(formatter, "w") + else: + return sys.stdout + |
