• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

adrienverge / yamllint / 7365719389
100%

Build:
DEFAULT BRANCH: master
Ran 30 Dec 2023 06:35PM UTC
Jobs 5
Files 65
Run time 4s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Dec 2023 06:34PM UTC coverage: 99.415% (+0.001%) from 99.414%
7365719389

push

github

adrienverge
tests: Prevent “unittest --buffer” from crashing

Before this change, if certain tests were failing in certain ways, then
running “python -m unittest --buffer” would cause an AttributeError in
the unittest module itself.

Here’s what unittest does when you use the --buffer argument:

1. It sets sys.stdout and sys.stderr to StringIOs [1].
2. It runs a test.
3. If the test failed, it runs getvalue() on sys.stdout and sys.stderr
   to get data from its StringIOs.

tests/test_cli.py has its own RunContext class that does something
similar. Before this change, here’s what could happen:

1. unittest sets sys.stdout and sys.stderr to StringIOs.
2. unittest runs a test that uses RunContext.
3. A RunContext gets entered. It sets sys.stdout and sys.stderr to its
   own StringIOs.
4. The RunContext gets exited. It sets sys.stdout and sys.stderr to
   sys.__stdout__ and sys.__stderr__.
5. The test fails.
6. unittest assumes that sys.stdout is still set to one of its
   StringIOs, and runs sys.stdout.getvalue().
7. unittest crashes with this error:

	AttributeError: '_io.TextIOWrapper' object has no attribute 'getvalue'

[1]: <https://github.com/python/cpython/blob/<a class=hub.com/adrienverge/yamllint/commit/2305ca51448552542b2414186252123a8dc87db7">2305ca514/Lib/unittest/result.py#L65>
[2]: <https://github.com/python/cpython/blob/2305ca51448552542b2414186252123a8dc87db7/Lib/unittest/result.py#L87>

6 of 6 new or added lines in 1 file covered. (100.0%)

3906 of 3929 relevant lines covered (99.41%)

4.97 hits per line

Jobs
ID Job ID Ran Files Coverage
1 7365719389.1 30 Dec 2023 06:35PM UTC 0
99.34
2 7365719389.2 30 Dec 2023 06:35PM UTC 0
99.41
3 7365719389.3 30 Dec 2023 06:35PM UTC 0
99.34
4 7365719389.4 30 Dec 2023 06:35PM UTC 0
99.41
5 7365719389.5 30 Dec 2023 06:35PM UTC 0
99.41
Source Files on build 7365719389
Detailed source file information is not available for this build.
  • Back to Repo
  • 152ba20f on github
  • Prev Build on master (#7365429379)
  • Next Build on master (#7411988604)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc