astropy/astropy — pull request #1530 by mdboom (2013-10-05 14:26:21+00:00)
Title: py.test cannot run if sys.stdout.encoding is None

If for any reason ``sys.stdout.encoding`` is ``None``, then one cannot currently run the tests:

```
============================= test session starts ==============================
platform darwin -- Python 2.7.5 -- pytest-2.4.0
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "_pytest.main", line 81, in wrap_session
INTERNALERROR> config.hook.pytest_sessionstart(session=session)
INTERNALERROR> File "_pytest.core", line 364, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "_pytest.core", line 375, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "_pytest.core", line 293, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "_pytest.terminal", line 276, in pytest_sessionstart
INTERNALERROR> config=self.config, startdir=self.startdir)
INTERNALERROR> File "_pytest.core", line 364, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "_pytest.core", line 375, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "_pytest.core", line 293, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "astropy/tests/pytest_plugins.py", line 299, in pytest_report_header
INTERNALERROR> plat = plat.decode(sys.stdout.encoding)
INTERNALERROR> TypeError: decode() argument 1 must be string, not None
```

It might be good to add a workaround for this case.