Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags Filtering Fix #6083

Merged
merged 1 commit into from
Dec 19, 2024
Merged

Conversation

harvey0100
Copy link
Contributor

Filtering now properly handles both verbose and non-verbose output modes while checking for tag matches.
without changing the existing behavior that users expect when using 'avocado list -t '

Reference: #6066

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.65%. Comparing base (3b95771) to head (d4624dd).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6083      +/-   ##
==========================================
+ Coverage   68.63%   68.65%   +0.02%     
==========================================
  Files         202      202              
  Lines       21910    21932      +22     
==========================================
+ Hits        15037    15058      +21     
- Misses       6873     6874       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@clebergnu clebergnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @harvey0100, thanks for this! While it fixes the issue, I believe having the exact behavior of the filtering reused is a must.

Also, adding test coverage so that this doesn't happen again is appreciated. Something as simple as this:

diff --git a/selftests/functional/list.py b/selftests/functional/list.py
index 2be6213e3..71f0b1354 100644
--- a/selftests/functional/list.py
+++ b/selftests/functional/list.py
@@ -153,6 +153,23 @@ class ListTestFunctional(TestCaseTmpDir):
             (f"Avocado did not return rc " f"{exit_codes.AVOCADO_ALL_OK}:\n{result}"),
         )
         stdout_lines = result.stdout_text.splitlines()
+        self.assertRegex(
+            stdout_lines[1],
+            r"avocado-instrumented\s.*examples/tests/cit_parameters.py:CitParameters.test\s.*examples/tests/cit_parameters.py:CitParameters.test\savocado-instrumented\sfast",
+        )
+        self.assertRegex(
+            stdout_lines[2],
+            r"avocado-instrumented\s.*examples/tests/passtest.py:PassTest.test\s.*examples/tests/passtest.py:PassTest.test\s.*avocado-instrumented\sfast",
+        )
+        self.assertRegex(
+            stdout_lines[3],
+            r"avocado-instrumented\s.*examples/tests/tags.py:FastTest.test_fast\s.*examples/tests/tags.py:FastTest.test_fast\s.*avocado-instrumented\snet,fast",
+        )
+        self.assertRegex(
+            stdout_lines[4],
+            r"avocado-instrumented\s.*examples/tests/tags.py:FastTest.test_fast_other\s.*examples/tests/tags.py:FastTest.test_fast_other\s.*avocado-instrumented\snet,fast",
+        )
+        self.assertEqual("", stdout_lines[5])
         self.assertIn("TEST TYPES SUMMARY", stdout_lines)
         self.assertIn("avocado-instrumented: 4", stdout_lines)
         self.assertIn("TEST TAGS SUMMARY", stdout_lines)

Should do the trick.

Thanks!

avocado/plugins/list.py Outdated Show resolved Hide resolved
@harvey0100 harvey0100 force-pushed the filtertags branch 2 times, most recently from d4624dd to 51492c3 Compare December 19, 2024 12:07
Filtering now properly handles both verbose and non-verbose output modes
while checking for tag matches.
without changing the existing behavior that users expect when using
'avocado list -t <tag>'

Reference:      avocado-framework#6066
Signed-off-by: Harvey Lynden <hlynden@redhat.com>
@harvey0100
Copy link
Contributor Author

Hi @clebergnu

Thanks for your comments, in complete agreement I've made the changes as requested :)

Copy link
Contributor

@clebergnu clebergnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@clebergnu clebergnu merged commit 56b8eec into avocado-framework:master Dec 19, 2024
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done 109
Development

Successfully merging this pull request may close these issues.

2 participants