Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 import os | |
2 import pytest | |
3 | |
4 SOURCEPATH = 'cms/tests/test_site/pages/' | |
Vasily Kuznetsov
2016/07/01 14:26:15
It's better to not use relative paths like this to
Jon Sonesen
2016/07/01 15:58:13
Thanks for the tip I will get that fixed up.
| |
5 | |
6 | |
7 @pytest.fixture(scope='session', autouse=True) | |
8 def dynamic_session_setup(request): | |
9 seen = set() | |
10 session = request.node | |
11 for item in session.items: | |
12 cls = item.getparent(pytest.Class) | |
13 if cls not in seen: | |
14 if hasattr(cls.obj, 'run_test_server'): | |
Vasily Kuznetsov
2016/07/01 14:26:15
Why not just run the test server in this fixture?
Jon Sonesen
2016/07/01 15:58:13
Yeah I agree, I am going to include the setup/tear
| |
15 seen.add(cls) | |
16 p = cls.obj.run_test_server() | |
17 | |
18 def dynamic_tear_down(): | |
19 p.terminate() | |
20 request.addfinalizer(dynamic_tear_down) | |
Sebastian Noack
2016/07/01 14:56:23
Note that the wrapper function is redundant. You c
Jon Sonesen
2016/07/01 15:58:13
Thank you, however once the teardown for static an
| |
21 | |
22 | |
23 @pytest.fixture(scope='session') | |
24 def get_pages(): | |
25 return_data = set() | |
26 print os.walk(SOURCEPATH) | |
27 for (dirpath, dirnames, filenames) in os.walk(SOURCEPATH): | |
28 for input_file in filenames: | |
29 return_data.add(input_file) | |
30 return return_data | |
OLD | NEW |