Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
(#18) Added a fixture for accessing data files
Browse files Browse the repository at this point in the history
Added a new fixture for using data files on test cases that
require generating/validating execution against 'model' data.
  • Loading branch information
leandor committed Jul 1, 2017
1 parent f6039e0 commit 352d154
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/papi/test_lz4.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
from __future__ import unicode_literals
from distutils import dir_util
from pytest import fixture
from os import path


@fixture
def datadir(tmpdir, request):
'''
Fixture responsible for searching a folder with the same name of test
module and, if available, moving all contents to a temporary directory so
tests can use them freely.
'''
filename = request.module.__file__
test_dir, _ = path.splitext(filename)

if path.isdir(test_dir):
dir_util.copy_tree(test_dir, bytes(tmpdir))

return tmpdir

@fixture
def lz4():
Expand Down

0 comments on commit 352d154

Please sign in to comment.