Skip to content

Commit

Permalink
fix: flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Nov 13, 2024
1 parent bc5f1ea commit 63123b9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/modularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def pub_and_sub(args):
# Expected z_sub output & status
if args.sub == 1:
if args.pub == 1:
z_sub_expected_status = 0
z_sub_expected_status = [0, -2]
z_sub_expected_output = """Opening session...
Declaring Subscriber on 'demo/example/**'...
Press CTRL-C to quit...
Expand All @@ -63,12 +63,12 @@ def pub_and_sub(args):
>> [Subscriber] Received ('demo/example/zenoh-pico-pub': '[ 8] Pub from Pico!')
>> [Subscriber] Received ('demo/example/zenoh-pico-pub': '[ 9] Pub from Pico!')"""
else:
z_sub_expected_status = -2
z_sub_expected_status = [-2]
z_sub_expected_output = """Opening session...
Declaring Subscriber on 'demo/example/**'...
Press CTRL-C to quit..."""
else:
z_sub_expected_status = 254
z_sub_expected_status = [254]
z_sub_expected_output = "ERROR: Zenoh pico was compiled without " "Z_FEATURE_SUBSCRIPTION but this example requires it."

print("Start subscriber")
Expand Down Expand Up @@ -133,7 +133,7 @@ def pub_and_sub(args):
print("Check subscriber status & output")
# Check the exit status of z_sub
z_sub_status = z_sub_process.returncode
if z_sub_status == z_sub_expected_status:
if z_sub_status in z_sub_expected_status:
print("z_sub status valid")
else:
print(f"z_sub status invalid, expected: {z_sub_expected_status}, received: {z_sub_status}")
Expand Down Expand Up @@ -177,19 +177,19 @@ def query_and_queryable(args):
# Expected z_queryable output & status
if args.queryable == 1:
if args.query == 1:
z_queryable_expected_status = 0
z_queryable_expected_status = [0, -2]
z_queryable_expected_output = """Opening session...
Creating Queryable on 'demo/example/zenoh-pico-queryable'...
Press CTRL-C to quit...
>> [Queryable handler] Received Query 'demo/example/**'
"""
else:
z_queryable_expected_status = -2
z_queryable_expected_status = [-2]
z_queryable_expected_output = """Opening session...
Creating Queryable on 'demo/example/zenoh-pico-queryable'...
Press CTRL-C to quit..."""
else:
z_queryable_expected_status = 254
z_queryable_expected_status = [254]
z_queryable_expected_output = "ERROR: Zenoh pico was compiled without " "Z_FEATURE_QUERYABLE but this example requires it."

print("Start queryable")
Expand Down Expand Up @@ -254,7 +254,7 @@ def query_and_queryable(args):
print("Check queryable status & output")
# Check the exit status of z_queryable
z_queryable_status = z_queryable_process.returncode
if z_queryable_status == z_queryable_expected_status:
if z_queryable_status in z_queryable_expected_status:
print("z_queryable status valid")
else:
print(f"z_queryable status invalid, expected: {z_queryable_expected_status}," f" received: {z_queryable_status}")
Expand Down

0 comments on commit 63123b9

Please sign in to comment.