Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: tests/test_generation_exceptional_cases.py

Issue 29887585: Issue #5352 - generate_static_pages cannot deal with directories being turned into regular pages (Closed)
Left Patch Set: Addressed comments from Patch Set #2 Created Oct. 4, 2018, 6:31 a.m.
Right Patch Set: Addressed comments from Patch Set #4 Created Oct. 5, 2018, 11:28 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « tests/expected_output/en/sitemap ('k') | tests/test_site/pages/foo/bar.md » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 assert os.path.isdir(os.path.join(target_dir_with_file, 'en', 'foo')) 55 assert os.path.isdir(os.path.join(target_dir_with_file, 'en', 'foo'))
56 56
57 57
58 def test_generate_file_instead_of_dir(temp_site, target_dir_with_dir): 58 def test_generate_file_instead_of_dir(temp_site, target_dir_with_dir):
59 """Case where a directory from previous version becomes a file.""" 59 """Case where a directory from previous version becomes a file."""
60 generate_pages(str(temp_site), str(target_dir_with_dir)) 60 generate_pages(str(temp_site), str(target_dir_with_dir))
61 61
62 assert os.path.isfile(os.path.join(target_dir_with_dir, 'en', 'translate')) 62 assert os.path.isfile(os.path.join(target_dir_with_dir, 'en', 'translate'))
63 63
64 64
65 @pytest.mark.script_launch_mode('subprocess')
66 def test_generate_fifo_instead_of_file(temp_site, target_dir_with_fifo, 65 def test_generate_fifo_instead_of_file(temp_site, target_dir_with_fifo,
67 script_runner): 66 script_runner):
68 cmd = ['python', '-m', 'cms.bin.generate_static_pages', str(temp_site), 67 """Case with an unsupported item encountered (FIFO)."""
69 str(target_dir_with_fifo)] 68 with pytest.raises(Exception) as exp:
69 generate_pages(str(temp_site), str(target_dir_with_fifo))
70 70
71 ret = script_runner.run(*cmd) 71 assert 'It is neither a file, nor a directory!' in str(exp.value)
72
73 assert not ret.success
74 assert 'It is neither a file, nor a directory!' in ret.stderr
LEFTRIGHT

Powered by Google App Engine
This is Rietveld