Commits

Ronny Pfannschmidt committed b7dfa8d

kinda works

  • Participants
  • Parent commits 8141e70

Comments (0)

Files changed (3)

File pytest_ghostpy/plugin.py

+from .wrapper import WrappedGhost
 
+def pytest_funcarg__ghost_base(request):
+    return request.config.getini('ghost_base')
+
+def pytest_funcarg__ghost(request):
+    base = request.getfuncargvalue('ghost_base')
+    return WrappedGhost(base)

File pytest_ghostpy/wrapper.py

+'''
+wraps the ghost.py base into something with a bit more extra knowledge
+'''
+from ghost import Ghost
+
+class WrappedGhost(object):
+    def __init__(self, base):
+        self.base = base
+        self.ghost = Ghost()
+
+    def open(self, path, method='get'):
+        return self.ghost.open(self.base+path, method)
+
+
+    def __getattr__(self, attr):
+        return getattr(self.ghost, attr)
     setup_requires=[
         'hgdistver',
     ],
-    entrypoints = {
-        'pytest11': {
-            'ghostpy': 'pytest_ghostpy.plugin',
-        },
+    entry_points = {
+        'pytest11': [
+            'ghostpy = pytest_ghostpy.plugin',
+        ],
     },
 )