Skip to content

Commit

Permalink
TST: Use absolute path for datapath (pandas-dev#21647)
Browse files Browse the repository at this point in the history
  • Loading branch information
elmq0022 authored and TomAugspurger committed Jun 27, 2018
1 parent b35cb1c commit 44c5460
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit 44c5460

Please sign in to comment.