twisted / twisted/twisted

Error during logging with trial: StdioOnnaStick instance has no attribute 'isatty'

Open
#3,067 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug new priority-low trial
Dominant language
Python
Stars
6k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
10

Description

tremolo's avatar tremolo reported
Trac ID trac#3067
Type defect
Created 2008-03-07 13:04:57Z

In _AnsiColorizer.supported() in module twisted.trial.reporter the call to sys.stderr.isatty() fails, because sys.stderr is wrapped by a StdioOnnaStick instance
and there is no isatty method in that class.

This issue came up already in

http://twistedmatrix.com/pipermail/twisted-python/2007-November/016380.html

but i could not find a matching ticket and the problem remains in svn trunk.

I attached a little patch to add a hasattr test to make sure isatty() is present.
It might also be a good idea to give StdioOnnaStick an isatty method and i added another patch to do that.

Attachments:

Searchable metadata
trac-id__3067 3067
type__defect defect
reporter__tremolo tremolo
priority__low low
milestone__ 
branch__ 
branch_author__ 
status__new new
resolution__None None
component__trial trial
keywords__trial_reporter_isatty_StdioOnnaStick trial reporter isatty StdioOnnaStick
time__1204895097000000 1204895097000000
changetime__1243884829000000 1243884829000000
version__None None
owner__ 
cc__tremolo

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in twisted.trial.reporter, at _AnsiColorizer.supported(), and inspect StdioOnnaStick where trial replaces sys.stderr. Reproduce the logging failure under trial and compare the attached isatty_check.patch and isatty_StdioOnnaStick.patch. Done means trial logging no longer raises when stderr lacks isatty, with the relevant reporter behavior verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.