File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -440,6 +440,8 @@ def _generate_environment(self, config):
440440 value = metadata [key ]
441441 if isinstance (value , basestring ) and value .startswith ('http' ):
442442 value = html .a (value , href = value , target = '_blank' )
443+ elif isinstance (value , (list , tuple , set )):
444+ value = ', ' .join ((str (i ) for i in value ))
443445 rows .append (html .tr (html .td (key ), html .td (value )))
444446
445447 environment .append (html .table (rows , id = 'environment' ))
Original file line number Diff line number Diff line change @@ -490,6 +490,24 @@ def pytest_configure(config):
490490 assert 'Environment' in html
491491 assert len (re .findall (content , html )) == 1
492492
493+ def test_environment_list_value (self , testdir ):
494+ content = tuple (str (random .random ()) for i in range (10 ))
495+ content += tuple (random .random () for i in range (10 ))
496+ expected_content = ', ' .join ((str (i ) for i in content ))
497+ expected_html_re = '<td>content</td>\n \s+<td>{}</td>' .format (
498+ expected_content
499+ )
500+ testdir .makeconftest ("""
501+ def pytest_configure(config):
502+ for i in range(2):
503+ config._metadata['content'] = {0}
504+ """ .format (content ))
505+ testdir .makepyfile ('def test_pass(): pass' )
506+ result , html = run (testdir )
507+ assert result .ret == 0
508+ assert 'Environment' in html
509+ assert len (re .findall (expected_html_re , html )) == 1
510+
493511 @pytest .mark .xfail (
494512 sys .version_info < (3 , 2 ) and
495513 LooseVersion (pytest .__version__ ) >= LooseVersion ('2.8.0' ),
You can’t perform that action at this time.
0 commit comments