Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable spinners when not outputting to a TTY #46

Closed
vidyarani-dg opened this issue Jan 24, 2018 · 9 comments · Fixed by #50
Closed

Disable spinners when not outputting to a TTY #46

vidyarani-dg opened this issue Jan 24, 2018 · 9 comments · Fixed by #50
Labels

Comments

@vidyarani-dg
Copy link

I am using halo for the spinners and it works absolutely fine while running the management command from the command line, however I do not want the spinners while running my test suite. This is cluttering my tests and I want to disable it. I don't see an option to disable it. The only other option is to write the output to a file.

Is it possible to disable the spinners when not outputting to a TTY ?

Description

  • Disable spinners when not outputting to a TTY

System settings

  • Operating System: Ubuntu 16.04.3 LTS
  • Python version: 3.6.3
  • Halo version: 0.0.10
@manrajgrover
Copy link
Owner

@vidyarani-dg We do have an option for enabling and disabling the spinner. I believe you can disable it in your test environment using this.

@vidyarani-dg
Copy link
Author

I see , thanks! It's clearly in the initialization. Sorry, I missed it.

Will close this issue.

@manrajgrover
Copy link
Owner

@vidyarani-dg Did it work as per your requirement?

@vidyarani-dg
Copy link
Author

@manrajgrover : Apologies for the tardiness in getting back to you, I did try

Halo(text='Loading files', enabled=False)

It did disable the info messages, however the errors are still outputting to the terminal.

Is this how it is supposed to work ?

@vidyarani-dg vidyarani-dg reopened this Feb 16, 2018
@manrajgrover
Copy link
Owner

@vidyarani-dg Which errors are being outputted? I would need more information in order to assist.

@vidyarani-dg
Copy link
Author

vidyarani-dg commented Feb 19, 2018

@manrajgrover : Sorry, the failure messages . For instance, this is how I am using the spinner.

With enabled=False, I do not see any of the success / text messages on the terminal, however I do see the failure messages.

spinner = Halo(text='Loading files', spinner='dots', enabled=False)
spinner.start()


for row in rows:
    spinner.text = 'Processing line {}'.format(row.rownum)
    try:
        load(row)
    except Exception:
        spinner.fail("Error loading row {}".format(message)) # -> This is outputted to the terminal. 
        spinner.start()

spinner.succeed('Load successful, time taken in seconds: {}'.format((end - start).seconds))
spinner.stop()

@manrajgrover
Copy link
Owner

@vidyarani-dg Got it. Thanks for reporting this. I'll fix this and notify you with the release.

@vidyarani-dg
Copy link
Author

Thank you.

@manrajgrover
Copy link
Owner

@vidyarani-dg Made a release with fix in v0.0.11. Please upgrade and check if it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants