Skip to content

Fix handling of sys.stdout.encoding being None#300

Merged
altendky merged 7 commits intotwisted:masterfrom
altendky:none_encoding
Dec 19, 2020
Merged

Fix handling of sys.stdout.encoding being None#300
altendky merged 7 commits intotwisted:masterfrom
altendky:none_encoding

Conversation

@altendky
Copy link
Copy Markdown
Member

Fixes #175.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Dec 14, 2020

Codecov Report

Merging #300 (8a1ce47) into master (87860f3) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #300      +/-   ##
==========================================
+ Coverage   95.39%   95.47%   +0.07%     
==========================================
  Files          20       20              
  Lines        1043     1060      +17     
  Branches      103      104       +1     
==========================================
+ Hits          995     1012      +17     
  Misses         27       27              
  Partials       21       21              
Impacted Files Coverage Δ
src/towncrier/check.py 94.11% <100.00%> (+0.36%) ⬆️
src/towncrier/test/test_check.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87860f3...8a1ce47. Read the comment docs.

Copy link
Copy Markdown
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good. Only a medium comment regarding the test.
I think that the test can be updated and then merged without another review.

Thanks!

Comment on lines +142 to +145
check_call(
[sys.executable, '-m', 'towncrier.check', "--compare-with", "master"],
stdout=PIPE,
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like how this assertion is done.

From Python docs

Note
Do not use stdout=PIPE or stderr=PIPE with this function. The child process will block if it generates enough output to a pipe to fill up the OS pipe buffer as the pipes are not being read from.

proc = subprocess.Popen([sys.executable, '-m', 'towncrier.check', "--compare-with", "master"], stdout=PIPE, stder=PIPE)
try:
    outs, errs = proc.communicate(timeout=15)
except TimeoutExpired:
    proc.kill()
    outs, errs = proc.communicate()

and then check that err is empty and the out has the expecte output and no sign of error.
Not sure how to check for no errors in stdout... but maybe in the future we can have towncrier sending all errors to stderr and then checking for an empty stderr is enough.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented without the timeout since py2 doesn't have timeout. Could go for subprocess32 or something if it's particularly important (sure, it's obviously nice).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's ok without the timeout

@altendky
Copy link
Copy Markdown
Member Author

Kick again to see if codecov works better

@altendky altendky closed this Dec 19, 2020
@altendky altendky reopened this Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failure to run in GitHub Actions

3 participants