| OLD | NEW |
| 1 import os | 1 import os |
| 2 import pytest | 2 import pytest |
| 3 import shutil | 3 import shutil |
| 4 import subprocess | 4 import subprocess |
| 5 | 5 |
| 6 | 6 |
| 7 ROOTPATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 7 ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 8 TEST_SITE_PATH = os.path.join(ROOT_PATH, 'tests', 'test_site') |
| 9 PAGE_LIST = [ |
| 10 filename.split('.')[0] |
| 11 for filename in os.listdir(os.path.join(TEST_SITE_PATH, 'pages')) |
| 12 ] |
| 13 LANG_LIST = ['en', 'de'] |
| 8 | 14 |
| 9 | 15 |
| 10 @pytest.fixture(scope='session') | 16 @pytest.fixture(scope='session') |
| 11 def temp_site(tmpdir_factory): | 17 def temp_site(tmpdir_factory): |
| 12 out_dir = tmpdir_factory.mktemp('temp_out') | 18 out_dir = tmpdir_factory.mktemp('temp_out') |
| 13 site_dir = out_dir.join('test_site').strpath | 19 site_dir = out_dir.join('test_site').strpath |
| 14 | 20 |
| 15 shutil.copytree(os.path.join(ROOTPATH, 'tests', 'test_site'), site_dir) | 21 shutil.copytree(TEST_SITE_PATH, site_dir) |
| 16 subprocess.check_call(['hg', 'init', site_dir]) | 22 subprocess.check_call(['hg', 'init', site_dir]) |
| 17 subprocess.check_call(['hg', '-R', site_dir, 'commit', '-A', '-m', 'foo']) | 23 subprocess.check_call(['hg', '-R', site_dir, 'commit', '-A', '-m', 'foo']) |
| 18 | 24 |
| 19 subprocess.check_call(['hg', '-R', site_dir, 'bookmark', 'master']) | 25 subprocess.check_call(['hg', '-R', site_dir, 'bookmark', 'master']) |
| 20 subprocess.check_call(['hg', '-R', site_dir, 'bookmark', 'test']) | 26 subprocess.check_call(['hg', '-R', site_dir, 'bookmark', 'test']) |
| 21 subprocess.check_call(['touch', os.path.join(site_dir, 'pages', 'bar.md')]) | 27 subprocess.check_call(['touch', os.path.join(site_dir, 'pages', 'bar.md')]) |
| 22 subprocess.check_call(['hg', '-R', site_dir, 'commit', '-A', '-m', 'bar']) | 28 subprocess.check_call(['hg', '-R', site_dir, 'commit', '-A', '-m', 'bar']) |
| 23 yield site_dir | 29 yield site_dir |
| OLD | NEW |