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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cms/tests/dynamic_tests/conftest.py
===================================================================
new file mode 100644
--- /dev/null
+++ b/cms/tests/dynamic_tests/conftest.py
@@ -0,0 +1,30 @@
+import os
+import pytest
+
+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.
+
+
+@pytest.fixture(scope='session', autouse=True)
+def dynamic_session_setup(request):
+ seen = set()
+ session = request.node
+ for item in session.items:
+ cls = item.getparent(pytest.Class)
+ if cls not in seen:
+ 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
+ seen.add(cls)
+ p = cls.obj.run_test_server()
+
+ def dynamic_tear_down():
+ p.terminate()
+ 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
+
+
+@pytest.fixture(scope='session')
+def get_pages():
+ return_data = set()
+ print os.walk(SOURCEPATH)
+ for (dirpath, dirnames, filenames) in os.walk(SOURCEPATH):
+ for input_file in filenames:
+ return_data.add(input_file)
+ return return_data

Powered by Google App Engine
This is Rietveld