Left: | ||
Right: |
OLD | NEW |
---|---|
1 import os | 1 import os |
2 import sys | 2 import sys |
3 import runpy | 3 import runpy |
4 import pytest | 4 import pytest |
5 import urllib2 | 5 import urllib2 |
6 | 6 |
7 from .conftest import ROOTPATH | 7 from .conftest import ROOTPATH |
8 from .utils import get_dir_contents, run_test_server | 8 from .utils import get_dir_contents, run_test_server |
9 | 9 |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 yield ts | 48 yield ts |
49 | 49 |
50 | 50 |
51 @pytest.fixture(scope='session') | 51 @pytest.fixture(scope='session') |
52 def output_pages(static_output): | 52 def output_pages(static_output): |
53 return get_dir_contents(static_output) | 53 return get_dir_contents(static_output) |
54 | 54 |
55 | 55 |
56 @pytest.mark.parametrize('filename,expected_output', static_expected_outputs) | 56 @pytest.mark.parametrize('filename,expected_output', static_expected_outputs) |
57 def test_static(output_pages, filename, expected_output): | 57 def test_static(output_pages, filename, expected_output): |
58 assert output_pages[filename] == expected_output | 58 if expected_output.startswith('## MISSING'): |
Vasily Kuznetsov
2018/01/19 15:34:29
This allows us to check that a certain file _is_no
Jon Sonesen
2018/01/19 19:25:35
Acknowledged.
| |
59 assert filename not in output_pages | |
60 else: | |
61 assert expected_output == output_pages[filename] | |
59 | 62 |
60 | 63 |
61 @pytest.mark.parametrize('filename,expected_output', dynamic_expected_outputs) | 64 @pytest.mark.parametrize('filename,expected_output', dynamic_expected_outputs) |
62 def test_dynamic(dynamic_server, filename, expected_output): | 65 def test_dynamic(dynamic_server, filename, expected_output): |
63 response = urllib2.urlopen(dynamic_server + filename) | 66 response = urllib2.urlopen(dynamic_server + filename) |
64 assert response.read().strip() == expected_output | 67 assert expected_output == response.read().strip() |
Vasily Kuznetsov
2018/01/19 15:34:29
I changed the order of arguments in a comparison t
Jon Sonesen
2018/01/19 19:25:35
Acknowledged.
| |
65 | 68 |
66 | 69 |
67 def test_revision_arg(revision, output_pages): | 70 def test_revision_arg(revision, output_pages): |
68 if revision is None: | 71 if revision is None: |
69 assert 'en/bar' in output_pages | 72 assert 'en/bar' in output_pages |
70 else: | 73 else: |
71 assert 'en/bar' not in output_pages | 74 assert 'en/bar' not in output_pages |
OLD | NEW |