Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: cms/tests/dynamic_tests/conftest.py

Issue 29345468: Issue 4045 - Add Test Suite To CMS (Closed)
Patch Set: fix Popen object return Created June 29, 2016, 1:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld