Skip to content

Commit

Permalink
Merge pull request #3 from smitterl/rename
Browse files Browse the repository at this point in the history
[naming] substitute pairwise by minimal
  • Loading branch information
smitterl authored Mar 5, 2021
2 parents 96b40b2 + f1d3539 commit 3bf8439
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
https://github.com/avocado-framework/avocado-vt/ uses cartesian_config to create list of test cases over the largest possible set of test parameter combinations, i.e. variants.

The `pairwise` takes a list of test case names (p1.p2.p3, e.g. virsh.domstats.argument) and filters out test cases whose test parameter values, represented by the variant name, have already been covered in another test case earlier in the list.
The `minimal` function takes a list of test case names (p1.p2.p3, e.g. virsh.domstats.argument) and filters out test cases whose test parameter values, represented by the variant name, have already been covered in another test case earlier in the list.

An example of what will be filtered can be seen in the unit test.

Example:

A filtered output could look like:
```bash
# python3 filter_avocado_list.py -s virsh.boot,boot_integration
# python3 minimal_avocado_list.py -s virsh.boot,boot_integration
virsh.boot.loadparm
virsh.boot.by_seabios.positive_test.options.boot.hd.file_disk.boot_dev.os_loader.valid_loader_type.valid_readonly
virsh.boot.by_seabios.positive_test.options.boot.hd.file_disk.boot_dev.os_loader.valid_loader_type.no_readonly
Expand Down Expand Up @@ -41,7 +41,7 @@ The number of test cases was reduced from 52 to 26.

The filter can be double checked by
```bash
# python3 filter_avocado_list.py -t virsh.boot,boot_integration > original.list
# python3 filter_avocado_list.py virsh.boot,boot_integration > filtered.list
# python3 minimal_avocado_list.py -t virsh.boot,boot_integration > original.list
# python3 minimal_avocado_list.py virsh.boot,boot_integration > filtered.list
diff -y filtered.list original.list
```
4 changes: 2 additions & 2 deletions filter_avocado_list.py → minimal_avocado_list.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import subprocess
import sys
from filter import pairwise
from minimal_filter import minimal

# holds the vt only filter
ONLY = []
Expand Down Expand Up @@ -54,7 +54,7 @@ def get_avocado_list():
print(name)
sys.exit(0)

filtered_test_names = pairwise(test_names)
filtered_test_names = minimal(test_names)
for name in filtered_test_names:
print(name)

Expand Down
8 changes: 4 additions & 4 deletions filter.py → minimal_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def parts(line):
p = line.split(SEP)
return p

def pairwise(lines):
def minimal(lines):
diag = []

for line in lines:
Expand Down Expand Up @@ -46,9 +46,9 @@ def pairwise(lines):

class TestDiagonal(unittest.TestCase):

def test_pairwise(self):
pairwised = pairwise(test_lines)
self.assertEqual(pairwised, ["a1.b1.c1", "a1.b1.c2", "a1.b2.c1", "a1.d1"])
def test_minimal(self):
minimald = minimal(test_lines)
self.assertEqual(minimald, ["a1.b1.c1", "a1.b1.c2", "a1.b2.c1", "a1.d1"])

if __name__ == '__main__':
unittest.main()

0 comments on commit 3bf8439

Please sign in to comment.