@@ -13,40 +13,39 @@ class RenderPatternsTests(SimpleTestCase):
1313
1414 def test_displays_patterns (self ):
1515 stdout = io .StringIO ()
16- call_command ( 'render_patterns' , dry_run = True , stdout = stdout )
17- stdout = stdout . getvalue ( )
16+ stderr = io . StringIO ( )
17+ call_command ( 'render_patterns' , dry_run = True , stdout = stdout , stderr = stderr )
1818 self .assertIn ("""patterns/atoms/tags_test_atom/tags_test_atom.html
1919patterns/atoms/test_atom/test_atom.html
20- """ , stdout )
20+ """ , stderr . getvalue () )
2121
2222 def test_verbose_output (self ):
2323 stdout = io .StringIO ()
24- call_command ( 'render_patterns' , dry_run = True , stdout = stdout , verbosity = 2 )
25- stdout = stdout . getvalue ( )
24+ stderr = io . StringIO ( )
25+ call_command ( 'render_patterns' , dry_run = True , stdout = stdout , stderr = stderr , verbosity = 2 )
2626 self .assertIn ("""Target directory: dpl-rendered-patterns
2727Group: atoms
28- Group: tags_test_atom
29- Pattern: tags_test_atom.html
30- patterns/atoms/tags_test_atom/tags_test_atom.html
31-
32-
33- SANDWICH
34- SANDNoneWICH
35- SAND0WICH
36- """ , stdout )
28+ Group: icons
29+ Pattern: icon.html
30+ patterns/atoms/icons/icon.html
31+ """ , stderr .getvalue ())
32+ self .assertIn ("""<svg class="icon icon--close" aria-hidden="true" focusable="false">
33+ <use xlink:href="#close"></use>
34+ </svg>""" , stdout .getvalue ())
3735
3836 def test_quiet_output (self ):
3937 stdout = io .StringIO ()
40- call_command ('render_patterns' , dry_run = True , stdout = stdout , verbosity = 0 )
41- stdout = stdout .getvalue ()
42- self .assertEqual (stdout , '' )
38+ stderr = io .StringIO ()
39+ call_command ('render_patterns' , dry_run = True , stdout = stdout , stderr = stderr , verbosity = 0 )
40+ self .assertEqual (stdout .getvalue (), '' )
41+ self .assertEqual (stderr .getvalue (), '' )
4342
4443 def test_shows_output_folder (self ):
4544 stdout = io .StringIO ()
45+ stderr = io .StringIO ()
4646 temp = tempfile .gettempdir ()
47- call_command ('render_patterns' , dry_run = True , stdout = stdout , output = temp , verbosity = 2 )
48- stdout = stdout .getvalue ()
49- self .assertIn (temp , stdout )
47+ call_command ('render_patterns' , dry_run = True , stdout = stdout , stderr = stderr , output = temp , verbosity = 2 )
48+ self .assertIn (temp , stderr .getvalue ())
5049
5150
5251class RenderPatternsFileSystemTests (SimpleTestCase ):
@@ -60,19 +59,21 @@ def tearDown(self):
6059
6160 def test_uses_output (self ):
6261 stdout = io .StringIO ()
62+ stderr = io .StringIO ()
6363 modification_time_before = Path (self .output ).stat ().st_mtime
64- call_command ('render_patterns' , dry_run = False , stdout = stdout , output = self .output )
64+ call_command ('render_patterns' , dry_run = False , stdout = stdout , stderr = stderr , output = self .output )
6565 self .assertNotEqual (Path (self .output ).stat ().st_mtime , modification_time_before )
66- stdout = stdout .getvalue ()
6766
6867 def test_uses_subfolders (self ):
6968 stdout = io .StringIO ()
70- call_command ('render_patterns' , dry_run = False , stdout = stdout , output = self .output )
69+ stderr = io .StringIO ()
70+ call_command ('render_patterns' , dry_run = False , stdout = stdout , stderr = stderr , output = self .output )
7171 subfolders = Path (self .output ).iterdir ()
7272 self .assertIn ('atoms' , [p .name for p in subfolders ])
7373
7474 def test_outputs_html (self ):
7575 stdout = io .StringIO ()
76- call_command ('render_patterns' , dry_run = False , stdout = stdout , output = self .output )
76+ stderr = io .StringIO ()
77+ call_command ('render_patterns' , dry_run = False , stdout = stdout , stderr = stderr , output = self .output )
7778 html_files = Path (self .output ).glob ('**/*.html' )
7879 self .assertIn ('test_atom.html' , [p .name for p in html_files ])
0 commit comments