If the csv file is always in the same directory as the test file you should use __file__
, something like:
def test_annualized():
fname = os.path.join(os.path.dirname(__file__), 'sample.csv')
pd.read_csv(fname)
See the python datamodel docs for some scant notes on __file__
.