You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/02/23 06:29:48 UTC

[buildstream] branch tristan/fix-artifact-completion-test created (now 8de8440)

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a change to branch tristan/fix-artifact-completion-test
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 8de8440  tests/frontend/completions.py: Make artifact completion test stable

This branch includes the following new commits:

     new 8de8440  tests/frontend/completions.py: Make artifact completion test stable

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[buildstream] 01/01: tests/frontend/completions.py: Make artifact completion test stable

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/fix-artifact-completion-test
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 8de844053f7f6065e9c76cecc331183c66548ade
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Wed Feb 23 15:28:10 2022 +0900

    tests/frontend/completions.py: Make artifact completion test stable
    
    The order in which artifacts are reported in the bash completion list
    is not guaranteed to be a stable order (and nothing really requires this
    to be), so update the test to allow both possible orders.
    
    This fixes the test randomly failing where artifacts were not being
    reported in the expected order.
---
 tests/frontend/completions.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/frontend/completions.py b/tests/frontend/completions.py
index a96580d..7d11250 100644
--- a/tests/frontend/completions.py
+++ b/tests/frontend/completions.py
@@ -359,11 +359,17 @@ def test_argument_artifact(cli, datafiles):
             words = result.output.splitlines()  # This leaves an extra space on each e.g. ['foo.bst ']
             words = [word.strip() for word in words]
 
+            # We should now be able to see the artifacts, but the order in which artifacts
+            # are displayed in the completion list is not guaranteed to be ordered, so we
+            # test for both orders.
             if i == 0:
-                expected = PROJECT_ELEMENTS + artifacts  # We should now be able to see the artifacts
+                expected1 = PROJECT_ELEMENTS + artifacts
+                expected2 = PROJECT_ELEMENTS + list(reversed(artifacts))
             elif i == 1:
-                expected = ["target.bst"] + artifacts
+                expected1 = ["target.bst"] + artifacts
+                expected2 = ["target.bst"] + list(reversed(artifacts))
             elif i == 2:
-                expected = artifacts
+                expected1 = artifacts
+                expected2 = list(reversed(artifacts))
 
-            assert expected == words
+            assert words == expected1 or words == expected2