Commit 91844fbf authored by juga's avatar juga
Browse files

Recover datadir fixture needed for v3bwfile tests

parent 7d69bc7d
......@@ -27,6 +27,29 @@ class _PseudoArguments(argparse.Namespace):
setattr(self, key, kw[key])
@pytest.fixture()
def datadir(request):
""" get, read, open test files from the "data" directory. """
class D:
def __init__(self, basepath):
self.basepath = basepath
def open(self, name, mode="r"):
return self.basepath.join(name).open(mode)
def join(self, name):
return self.basepath.join(name).strpath
def read(self, name):
with self.open(name, "r") as f:
return f.read()
def readlines(self, name):
with self.open(name, "r") as f:
return f.readlines()
return D(request.fspath.dirpath("data"))
@pytest.fixture(scope='session')
def parser():
return create_parser()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment