| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 import os | 1 import os |
| 2 import sys | 2 import sys |
| 3 import runpy | 3 import runpy |
| 4 | 4 |
| 5 import mock | 5 import mock |
| 6 import pytest | 6 import pytest |
| 7 import urllib2 | 7 import urllib2 |
| 8 | 8 |
| 9 from .conftest import ROOTPATH | 9 from .conftest import ROOTPATH |
| 10 from .utils import get_dir_contents, run_test_server | 10 from .utils import get_dir_contents, run_test_server |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 | 49 |
| 50 @pytest.fixture(scope='session') | 50 @pytest.fixture(scope='session') |
| 51 def output_pages(static_output): | 51 def output_pages(static_output): |
| 52 return get_dir_contents(static_output) | 52 return get_dir_contents(static_output) |
| 53 | 53 |
| 54 | 54 |
| 55 @pytest.mark.parametrize('filename,expected_output', static_expected_outputs) | 55 @pytest.mark.parametrize('filename,expected_output', static_expected_outputs) |
| 56 def test_static(output_pages, filename, expected_output): | 56 def test_static(output_pages, filename, expected_output): |
| 57 if expected_output.startswith('## MISSING'): | 57 if expected_output.startswith('## MISSING'): |
| 58 assert filename not in output_pages | 58 assert filename not in output_pages |
| 59 return | 59 else: |
| 60 assert expected_output == output_pages[filename] | 60 assert expected_output == output_pages[filename] |
| 61 | 61 |
| 62 | 62 |
| 63 @pytest.mark.parametrize('filename,expected_output', dynamic_expected_outputs) | 63 @pytest.mark.parametrize('filename,expected_output', dynamic_expected_outputs) |
| 64 def test_dynamic(dynamic_server, filename, expected_output): | 64 def test_dynamic(dynamic_server, filename, expected_output): |
| 65 response = urllib2.urlopen(dynamic_server + filename) | 65 response = urllib2.urlopen(dynamic_server + filename) |
| 66 assert expected_output == response.read().strip() | 66 assert expected_output == response.read().strip() |
| 67 | 67 |
| 68 | 68 |
| 69 def test_cache(output_pages): | 69 def test_cache(output_pages): |
| 70 source = FileSource(os.path.join('tests', 'test_site')) | 70 source = FileSource(os.path.join('test_site')) |
|
Vasily Kuznetsov
2018/07/03 08:50:24
Nit: It seems like having "tests/test_site" as bas
jsonesen
2018/07/05 18:58:31
Acknowledged.
| |
| 71 assert source.get_cache_dir() == os.path.join('tests', | 71 assert source.get_cache_dir() == os.path.join('test_site', 'cache') |
| 72 'test_site', 'cache') | |
| LEFT | RIGHT |