1

I am running running django-nose tests in a management command using call_command. I need to capture output and do something with it, depending on if it failed or passed. My current code in management command :

content = StringIO()
try:
    call_command('test', '--nologcapture', '-s', stdout=content)
        # since its calling system exit
except BaseException:
    pass
content.seek(0)
print content.read(), '<-- content'

# Check if test is passed and do something or else something else.

In my case, the content is always an empty string.

I tried a lot of nose plugins, but cannot fetch output.

Thanks.

iamkhush
  • 2,562
  • 3
  • 20
  • 34

0 Answers0