[
https://issues.apache.org/jira/browse/AURORA-595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14070437#comment-14070437
]
brian wickman commented on AURORA-595:
--------------------------------------
The key here is the "-s" option to pytest. You can't do capsys.readouterr() if
the user specifies "-s" (crazy, I know) because "-s" shunts the redirection so
it goes straight to stderr/stdout instead of into the local handles. If you do
{noformat}
./pants src/test/python/apache/aurora/common:test_cluster_option -s
{noformat}
it breaks:
{noformat}
mba=aurora=; ./pants src/test/python/apache/aurora/common:test_cluster_option -s
Build operating on top level addresses:
set([BuildFileAddress(/Users/wickman/clients/aurora/src/test/python/apache/aurora/common/BUILD,
test_cluster_option)])
====================================================================================================
test session starts
=====================================================================================================
platform darwin -- Python 2.6.7 -- py-1.4.22 -- pytest-2.6.0
plugins: cov, timeout
collected 2 items
src/test/python/apache/aurora/common/test_cluster_option.py .tmp5Rg7x_: error:
borg is not a valid cluster for the --source_cluster option. Valid options for
clusters are smf1 smf1-test
F
==========================================================================================================
FAILURES
==========================================================================================================
_______________________________________________________________________________________________________
test_parsable
________________________________________________________________________________________________________
capsys = <_pytest.capture.CaptureFixture instance at 0x1106ae830>
def test_parsable(capsys):
parser = options.parser().options((
ClusterOption('--source_cluster', '-s', clusters=CLUSTER_LIST),
ClusterOption('--dest_cluster', clusters=CLUSTER_LIST),
ClusterOption('--cluster', cluster_provider=cluster_provider)))
values, _ = parser.parse(['--source_cluster=smf1-test',
'--cluster=smf1-test'])
assert isinstance(values.source_cluster, Cluster)
assert isinstance(values.cluster, Cluster)
with pytest.raises(SystemExit):
parser.parse(['--source_cluster=borg'])
> out, err = capsys.readouterr()
src/test/python/apache/aurora/common/test_cluster_option.py:59:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.capture.CaptureFixture instance at 0x1106ae830>
def readouterr(self):
try:
return self._capture.readouterr()
except AttributeError:
> return self._outerr
E AttributeError: CaptureFixture instance has no attribute '_outerr'
/private/var/folders/4d/9tz0cd5n2n7947xs21gspsxc0000gp/T/tmp5Rg7x_/.deps/pytest-2.6.0-py2.py3-none-any.whl/_pytest/capture.py:205:
AttributeError
=============================================================================================
1 failed, 1 passed in 0.08 seconds
=============================================================================================
src.test.python.apache.aurora.common.test_cluster_option
..... FAILURE
{noformat}
> test_cluster_option test case failing
> --------------------------------------
>
> Key: AURORA-595
> URL: https://issues.apache.org/jira/browse/AURORA-595
> Project: Aurora
> Issue Type: Story
> Components: Testing
> Reporter: Jake Farrell
> Fix For: 0.5.0
>
>
> Test src.test.python.apache.aurora.common.test_cluster_option
> ..... FAILURE
> E AttributeError: CaptureFixture instance has no attribute '_outerr'
--
This message was sent by Atlassian JIRA
(v6.2#6252)