Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ def datapath(request):
ValueError
If the path doesn't exist and the --strict-data-files option is set.
"""
BASE_PATH = os.path.join(os.path.dirname(__file__), 'tests')

def deco(*args):
path = os.path.join('pandas', 'tests', *args)
path = os.path.join(BASE_PATH, *args)
if not os.path.exists(path):
if request.config.getoption("--strict-data-files"):
msg = "Could not find file {} and --strict-data-files is set."
Expand Down
7 changes: 6 additions & 1 deletion pandas/tests/util/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,5 +852,10 @@ def test_datapath_missing(datapath, request):
datapath('not_a_file')

result = datapath('data', 'iris.csv')
expected = os.path.join('pandas', 'tests', 'data', 'iris.csv')
expected = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
'data',
'iris.csv'
)

assert result == expected