Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 2840e78

move prepared files to a own autouse fixture

Comments (0)

Files changed (1)

tests/conftest.py

 @pytest.fixture(scope='session', params=metadata.backends)
 def vcs(request):
     wanted = request.config.getvalue('vcs')
-    if wanted and testcontext.param != wanted:
-        pytest.skip('%s not wanted for this test run' % testcontext.param)
+    if wanted and request.param != wanted:
+        pytest.skip('%s not wanted for this test run' % request.param)
     return request.param
 
 @pytest.fixture(scope='session')
     if the feature "wd:heavy" is not supported use repo as help
     """
     if 'wd:heavy' not in mgr.backend.features:
-        #repo = testcontext.getfuncargvalue('repo')
         wd = mgr.create_wd('wd', repo)
     else:
         wd = mgr.create_wd('wd')
+    return wd
 
+@pytest.fixture(autouse=True)
+def prepared_files(request):
+    print request, dir(request)
     fp = request.function
     if hasattr(fp, 'files'):
+        wd = request.getfuncargvalue('wd')
         files = fp.files.args[0]
         wd.put_files(files)
         assert wd.has_files(*files)
         if  hasattr(fp, 'commit'):
             wd.add(paths=list(files))
             wd.commit(message='initial commit')
-    return wd
 
 
-def pytest_collect_directory(path, parent):
-    for compiled_module in path.listdir("*.pyc"):
-        if not compiled_module.new(ext=".py").check():
-            compiled_module.remove()
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.