Skip to content

Instantly share code, notes, and snippets.

@dmerejkowsky
Last active January 27, 2016 22:43
Show Gist options
  • Save dmerejkowsky/27939a4cd8de4ff5b902 to your computer and use it in GitHub Desktop.
Save dmerejkowsky/27939a4cd8de4ff5b902 to your computer and use it in GitHub Desktop.
Using py.test fixtures
# in qisys.sh
def get_config_path():
return get_path(".config")
def get_share_path():
return get_path(".local/share")
def get_path():
# read XDG
# mkdir
# return full path
# in qisys.test.conftest
def fake_get_path(*args):
""" Return a path in ``tmpdir`` """
...
@pytest.fixture(autouse=True)
def tmpfiles(request, tmpdir):
mock.patch("qisys.sh.get_path", fake_get_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment