Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 import os | 1 import os |
2 import sys | 2 import sys |
3 import time | 3 import time |
4 import runpy | 4 import runpy |
5 import signal | 5 import signal |
6 import pytest | 6 import pytest |
7 import urllib2 | 7 import urllib2 |
8 import subprocess | 8 import subprocess |
9 from conftest import ROOTPATH | 9 from conftest import ROOTPATH |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 | 27 |
28 @pytest.fixture(scope='session', params=['master', None]) | 28 @pytest.fixture(scope='session', params=['master', None]) |
29 def revision(request): | 29 def revision(request): |
30 return request.param | 30 return request.param |
31 | 31 |
32 | 32 |
33 @pytest.fixture(scope='session') | 33 @pytest.fixture(scope='session') |
34 def static_output(revision, request, temp_site): | 34 def static_output(revision, request, temp_site): |
35 static_out_path = os.path.join(temp_site, 'static_out') | 35 static_out_path = os.path.join(temp_site, 'static_out') |
36 if revision is None: | 36 sys.argv = ['filler', temp_site, static_out_path] |
Vasily Kuznetsov
2017/04/03 15:15:52
We don't really need to repeat the standard args t
Jon Sonesen
2017/04/04 07:01:23
Done.
| |
37 sys.argv = ['filler', temp_site, static_out_path] | 37 if revision is not None: |
38 else: | 38 sys.argv += ['--rev', revision] |
39 sys.argv = ['filler', temp_site, static_out_path, '--rev', 'master'] | |
Vasily Kuznetsov
2017/04/03 15:15:52
The last item of the list should be `revision` but
Jon Sonesen
2017/04/04 07:01:23
Done.
| |
40 | 39 |
41 runpy.run_module('cms.bin.generate_static_pages', run_name='__main__') | 40 runpy.run_module('cms.bin.generate_static_pages', run_name='__main__') |
42 return static_out_path | 41 return static_out_path |
43 | 42 |
44 | 43 |
45 @pytest.yield_fixture() | 44 @pytest.yield_fixture() |
46 def dynamic_server(temp_site): | 45 def dynamic_server(temp_site): |
47 args = ['python', 'runserver.py', temp_site] | 46 args = ['python', 'runserver.py', temp_site] |
48 # Werkzeug is a dependency of flask which we are using for the mock api | 47 # Werkzeug is a dependency of flask which we are using for the mock api |
49 # however there is an issue with Werkzeug that prevents it from properly | 48 # however there is an issue with Werkzeug that prevents it from properly |
(...skipping 19 matching lines...) Expand all Loading... | |
69 def test_dynamic(dynamic_server, filename, expected_output): | 68 def test_dynamic(dynamic_server, filename, expected_output): |
70 response = urllib2.urlopen(dynamic_server + filename) | 69 response = urllib2.urlopen(dynamic_server + filename) |
71 assert response.read() == expected_output | 70 assert response.read() == expected_output |
72 | 71 |
73 | 72 |
74 def test_revision_arg(revision, output_pages): | 73 def test_revision_arg(revision, output_pages): |
75 if revision is None: | 74 if revision is None: |
76 assert 'bar' in output_pages | 75 assert 'bar' in output_pages |
77 else: | 76 else: |
78 assert 'bar' not in output_pages | 77 assert 'bar' not in output_pages |
LEFT | RIGHT |