In pytest (3.04; python 3.4) I'm trying to disable output capture under certain circumstances. I'm trying to follow the example on this doc page. However, I'm unable to specify capsys as a funcarg. As a follow-up, I'd like to accept both funcarg and on-funcarg arguments so that I can use a class method that takes one or more normal arguments. How can I do that?
Ideally, this class method would work:
def always_print(self, message, capsys):
with capsys.disabled():
print(message)
But, I can't even get this to work:
def always_print(capsys):
with capsys.disabled():
print('FIXME')
Getting the error:
...
> always_print()
E TypeError: always_print() missing 1 required positional argument: 'capsys'
Aucun commentaire:
Enregistrer un commentaire