GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — devstack/scripts/test_localpibox_log.py at docs · lpb-stack/devstack

Expand file tree

/

test_localpibox_log.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
41 lines (29 loc) · 1.17 KB
/

test_localpibox_log.py

Copy path

File metadata and controls

41 lines (29 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
"""localpibox.log tests: log levels and streams, color/no-color,
debug gating."""
from __future__ import annotations
from testharness import run_lpbx_suite, log_mod
import io
def test_log_levels_and_streams():
out, err = io.StringIO(), io.StringIO()
c = log_mod.Console(color=False, out=out, err=err, debug_enabled=True)
c.info("i"); c.done("d"); c.warn("w"); c.error("e"); c.debug("g")
assert out.getvalue() == "i\nd\n"
assert err.getvalue() == "w\ne\ng\n"
def test_log_color_and_no_color():
out, err = io.StringIO(), io.StringIO()
c = log_mod.Console(color=True, out=out, err=err)
c.info("hi")
assert "\033[0;32m" in out.getvalue() and "\033[0m" in out.getvalue()
c2 = log_mod.Console(color=False, out=out, err=err)
c2.info("plain")
assert out.getvalue().endswith("plain\n")
def test_log_debug_gated():
out, err = io.StringIO(), io.StringIO()
c = log_mod.Console(color=False, out=out, err=err, debug_enabled=False)
c.debug("hidden")
assert err.getvalue() == ""
def main() -> int:
return run_lpbx_suite("localpibox.log tests", globals())
if __name__ == "__main__":
raise SystemExit(main())
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.