Commit 27f69535 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

Merge branch 'fix-test-umv-dangling' into 'master'

Rework umv command to display each line a single time

Closes #2825

See merge request !3810
parents 1a789f1f 6da06db4
Pipeline #49096 passed with stages
in 129 minutes and 45 seconds
......@@ -936,33 +936,25 @@ def __umove(*args, **kwargs):
print("")
magic_char = "\033[F"
while group.is_moving:
def format_group(group):
positions = group.position_with_reals
dials = group.dial_with_reals
row = "".join(
[
"user ",
__row_positions(positions, motors, rfmt, sep=" "),
"\ndial ",
__row_positions(dials, motors, rfmt, sep=" "),
]
)
user_pos = __row_positions(positions, motors, rfmt, sep=" ")
dial_pos = __row_positions(dials, motors, rfmt, sep=" ")
row = f"user {user_pos}\ndial {dial_pos}"
ret_depth = magic_char * row.count("\n")
print("{}{}".format(ret_depth, row), end="", flush=True)
return f"{ret_depth}{row}"
previous_line = None
while group.is_moving:
previous_line = format_group(group)
print(previous_line, end="", flush=True)
sleep(0.1)
# print last time for final positions
positions = group.position_with_reals
dials = group.dial_with_reals
row = "".join(
[
"user ",
__row_positions(positions, motors, rfmt, sep=" "),
"\ndial ",
__row_positions(dials, motors, rfmt, sep=" "),
]
)
ret_depth = magic_char * row.count("\n")
print("{}{}".format(ret_depth, row), end="", flush=True)
last_line = format_group(group)
if previous_line != last_line:
print(last_line, end="", flush=True)
print("")
return group, motor_pos
......
......@@ -243,8 +243,8 @@ dial 1.000
OUTPUT_UMV_CALC_MOT2 = """
calc_mot2[keV] calc_mot1[keV] roby
\x1b[Fuser 4.000 2.000 1.000
dial 4.000 2.000 1.000\x1b[Fuser 4.000 2.000 1.000
\x1b[Fuser 0.000 0.000 0.000
dial 0.000 0.000 0.000\x1b[Fuser 4.000 2.000 1.000
dial 4.000 2.000 1.000
"""
......@@ -255,11 +255,14 @@ def test_umv_shell(capfd, default_session):
output = capfd.readouterr().out
assert output == OUTPUT_UMV_ROBY
def test_umv_calc_shell(capfd, default_session):
calc_mot2 = default_session.config.get("calc_mot2")
try:
umv(calc_mot2, 4)
output = capfd.readouterr().out
assert output == OUTPUT_UMV_CALC_MOT2
finally:
default_session.config.get("calc_mot1").controller.close()
calc_mot2.controller.close()
......
Supports Markdown
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