@@ -633,10 +633,22 @@ def pytest_configure(config):
633
633
assert "Environment" in html
634
634
assert len (re .findall (content , html )) == 1
635
635
636
- def test_environment_list_value (self , testdir ):
637
- content = tuple (str (random .random ()) for i in range (10 ))
638
- content += tuple (random .random () for i in range (10 ))
639
- expected_content = ", " .join (str (i ) for i in content )
636
+ _unsorted_tuples = [
637
+ ("Hello" , "fzWZP6vKRv" , "hello" , "garAge" , "123Go" ),
638
+ (2 , 4 , 2 , 1 , 54 ),
639
+ ("Yes" , 400 , "5.4" ),
640
+ ]
641
+ _sorted_tuples = [
642
+ "123Go, Hello, fzWZP6vKRv, garAge, hello" ,
643
+ "1, 2, 2, 4, 54" ,
644
+ "400, 5.4, Yes" ,
645
+ ]
646
+ _test_environment_list_value_data_set = zip (_unsorted_tuples , _sorted_tuples )
647
+
648
+ @pytest .mark .parametrize (
649
+ "content,expected_content" , _test_environment_list_value_data_set
650
+ )
651
+ def test_environment_list_value (self , testdir , content , expected_content ):
640
652
expected_html_re = fr"<td>content</td>\n\s+<td>{ expected_content } </td>"
641
653
testdir .makeconftest (
642
654
f"""
@@ -649,7 +661,29 @@ def pytest_configure(config):
649
661
result , html = run (testdir )
650
662
assert result .ret == 0
651
663
assert "Environment" in html
652
- assert len (re .findall (expected_html_re , html )) == 1
664
+ assert len (re .findall (expected_html_re , html )) == 1 , html
665
+
666
+ _unordered_dict = {k : len (k ) for k in _unsorted_tuples [0 ]}
667
+
668
+ @pytest .mark .parametrize ("unordered_dict" , [_unordered_dict ])
669
+ def test_environment_unordered_dict_value (self , testdir , unordered_dict ):
670
+ expected_html_re = (
671
+ r"<td>content</td>\n\s+<td>{'123Go': 5, 'Hello': 5, "
672
+ r"'fzWZP6vKRv': 10, 'garAge': 6, 'hello': 5}</td>"
673
+ )
674
+ testdir .makeconftest (
675
+ """
676
+ def pytest_configure(config):
677
+ values = dict({'Hello': 5, 'fzWZP6vKRv': 10, 'garAge': 6, 'hello': 5,
678
+ '123Go': 5})
679
+ config._metadata['content'] = values
680
+ """
681
+ )
682
+ testdir .makepyfile ("def test_pass(): pass" )
683
+ result , html = run (testdir )
684
+ assert result .ret == 0
685
+ assert "Environment" in html
686
+ assert len (re .findall (expected_html_re , html )) == 1 , html
653
687
654
688
def test_environment_ordered (self , testdir ):
655
689
testdir .makeconftest (
0 commit comments