Commit 3a7f3696 authored by Matias Guijarro's avatar Matias Guijarro

Merge branch 'fix_prdef_test' into 'master'

test: prdef: escape color and ansi terminal codes

See merge request !1346
parents 5938437a 8f355059
Pipeline #11490 passed with stages
in 40 minutes and 34 seconds
......@@ -7,6 +7,7 @@
import pytest
import time
import re
from import repl
from bliss.common import measurementgroup
from bliss import setup_globals
......@@ -113,7 +114,7 @@ def test_load_script_namespace(beacon):
def test_prdef(beacon, capsys):
visible_func_code = "\n\x1b[34;01mdef\x1b[39;49;00m \x1b[32;01mvisible_func\x1b[39;49;00m():\n \x1b[34;01mpass\x1b[39;49;00m\n\n"
visible_func_code = "\ndef visible_func():\n pass\n\n"
env_dict = dict()
session = beacon.get("test_session2")
......@@ -123,7 +124,8 @@ def test_prdef(beacon, capsys):
assert callable(env_dict.get("prdef"))
output = capsys.readouterr()[0]
assert output.endswith(visible_func_code)
ansi_escape = re.compile(r"\x1B\[[0-?]*[ -/]*[@-~]")
assert ansi_escape.sub("", output).endswith(visible_func_code)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment