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/' |
+ |
+ |
+@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'): |
+ p = cls.obj.run_test_server() |
+ seen.add(cls) |
+ |
+ def dynamic_tear_down(): |
+ p.terminate() |
+ request.addfinalizer(dynamic_tear_down) |
+ |
+ |
+@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 |